Zum Inhalt springen

Kommaseparierte insert records-Werte für CONTENT-Abfrage verwenden

Erstellt am 7. September 2008 · 17 Antworten · letzte Antwort am 9. September 2008

Tags: Frage

achille ·

Habe das folgendermassen umgesetzt:

plugin.tx_phpshorcutlocal_pi1 {
		shortcutLink {
			wrap = <li>|</li>
		}
	}

SHORTCUTS_LOCAL < plugin.tx_phpshortcutlocal_pi1

und im php so:

										 	function main($content,$conf)	{
		$this->conf=$conf;
		$this->pi_setPiVarDefaults();
		$this->pi_loadLL();
		
		$content = '';
		$ressh_num_rows = '';
		$shrecords = array();
		
		$where = 'pid = ' .$GLOBALS["TSFE"]->id .' AND colPos = 1';
		$res = $GLOBALS["TYPO3_DB"]->exec_SELECTquery(
				 'records',
				 'tt_content',
				 $where.$this->cObj->enableFields('tt_content'),
				 '',
				 'sorting ASC'
				 );

  while($row = $GLOBALS["TYPO3_DB"]->sql_fetch_assoc($res)) {

  					 $shrecords = split(',', $row["records"]);
						 foreach ($shrecords as $aktuell) {
								$where = 'uid = ' .substr($aktuell, 26);
								$ressh = $GLOBALS["TYPO3_DB"]->exec_SELECTquery(
										 'sh_title, sh_link',
										 'tx_shortcuts_shortcut',
										 $where.$this->cObj->enableFields('tx_shortcuts_shortcut')
										 );
								
while($rowshortcut = $GLOBALS["TYPO3_DB"]->sql_fetch_assoc($ressh)) {			
										 $this->conf['shortcutLink.']['parameter'] = $rowshortcut["sh_link"];
										 $this->cObj->typolink($rowshortcut["sh_title"], $this->conf['shortcutLink']); 
								}
						 }
						 }
  return $content;
	}

im frontend erscheint aber nichts mehr. der MARKER ist leer.

habe dann die var $this->conf['shortcutLink.']['parameter'] anzeigen lassen ob etwas drinsteht. und da steht auch der wert von $rowshortcut["sh_link"] drin.

vielen dank im voraus.
Claudio

steffenk ·

Du hast auch vergessen den Content zu akkumulieren, z.B.

$content .= $this->cObj->typolink($rowshortcut["sh_title"], $this->conf['shortcutLink']);
achille ·

Sorry, hatte ich nach dem post auch gemerkt und nachträglich eingefügt:

$content .= $this->cObj->typolink($rowshortcut["sh_title"], $this->conf['shortcutLink']);

das resultat ist jetzt der einfache text: Palliative care working group. das ist "sh_title"

steffenk ·

d.h. er kann mit dem Parameter nichts anfangen
$this->conf['shortcutLink.']['parameter'] = $rowshortcut["sh_link"];

sollte dann wohl eher pid sein ...

achille ·

sieht so aus. den parameter habe ich mal ausgegeben im frontend. der parameter stimmt und steht in: $this->conf['shortcutLink.']['parameter']

steffenk ·

mit 9#7 wirst Du Probleme bekommen
parameter = 9
section = 7

wobei 7 als section nicht valide ist, daher benennt TYPO3 die sections auch mit c[uid]

_blank brauchst Du auch nicht, da extTarget global gesetzt werden kann, TYPO3 erkennt selber, das es ein externer Link ist. Und target ist mit xhtml_strict nicht valide.

achille ·

mein problem ist aber, dass die verweise so in der datenbank stehen. die sind teil einer extension, welche es erlaubt in einem sysfolder links mit titel und verweis zu erfassen und dann mittels insert records auf jeder beliebigen seite zu platzieren.

das ist das input-field in der tca.php:

		"sh_link" => Array (		
			"exclude" => 1,		
			"label" => "LLL:EXT:esmo_shortcuts/locallang_db.xml:tx_esmoshortcuts_shortcut.sh_link",		
			"config" => Array (
				"type"     => "input",
				"size"     => "15",
				"max"      => "255",
				"checkbox" => "",
				"eval"     => "trim",
				"wizards"  => array(
					"_PADDING" => 2,
					"link"     => array(
						"type"         => "popup",
						"title"        => "Link",
						"icon"         => "link_popup.gif",
						"script"       => "browse_links.php?mode=wizard",
						"JSopenParams" => "height=300,width=500,status=0,menubar=0,scrollbars=1"
					)
				)
			)
		),
	),

für die links aus dem insert records feld muss ich aber über die tabelle tt_content und php.

so fing halt alles an.
danach stehen die werte so wie vorhin gezeigt in der db.

habe etwas ähnliches, mit links die auf jeder seite erscheinen. diese lese ich im TS mit CONTENT aus und formatiere sie mit TYPOLINK. dass sieht so aus:

	SHORTCUTS_GLOBAL {
		table = tx_shortcuts_shortcut
		select {
			pidInList = 19
		}
		renderObj = COA
		renderObj {
			10 = TEXT
			10.wrap = <li>|</li>
			10.field = sh_title
			10.typolink {
				parameter.field = sh_link
			}
		}
	}
steffenk ·

und Du hast immer noch keine links?

schau Dir doch vor cObj->typolink das conf-array an

t3lib_div::debug($this->conf['shortcutLink'],'Link');
achille ·

habe es folgendermassen hingekriegt:

	function main($content,$conf)	{
		$this->conf=$conf;
		$this->pi_setPiVarDefaults();
		$this->pi_loadLL();
		
		$content = '';
		$ressh_num_rows = '';
		$shrecords = array();
		
		$where = 'pid = ' .$GLOBALS["TSFE"]->id .' AND colPos = 1';
		$res = $GLOBALS["TYPO3_DB"]->exec_SELECTquery(
				 'records',
				 'tt_content',
				 $where.$this->cObj->enableFields('tt_content'),
				 '',
				 'sorting ASC'
				 );

  while($row = $GLOBALS["TYPO3_DB"]->sql_fetch_assoc($res)) {

  					 $shrecords = split(',', $row["records"]);
						 foreach ($shrecords as $aktuell) {
								$where = 'uid = ' .substr($aktuell, 26);
								$ressh = $GLOBALS["TYPO3_DB"]->exec_SELECTquery(
										 'sh_title, sh_link',
										 'tx_shortcuts_shortcut',
										 $where.$this->cObj->enableFields('tx_shortcuts_shortcut')
										 );
								
								while($rowshortcut = $GLOBALS["TYPO3_DB"]->sql_fetch_assoc($ressh)) {			
										 $content .= '<li>' .$this->cObj->getTypoLink($rowshortcut["sh_title"], $rowshortcut["sh_link"]) .'</li>'; 
								}
						 }
						 }
  return $content;
	}

im TYPOSCRIPT einfach dem MARKER das plugin zugewiesen:

SHORTCUTS_LOCAL < plugin.tx_phpshortcutlocal_pi1

somit hat diese zeile zum erfolg geführt. mit cObj->getTypoLink:

$content .= '<li>' .$this->cObj->getTypoLink($rowshortcut["sh_title"], $rowshortcut["sh_link"]) .'</li>';

vielen dank für die hilfe
ciao