Zum Inhalt springen

Verständnisfrage: $this->cObj->start und .field

Erstellt am 20. August 2008 · 1 Antwort · letzte Antwort am 20. August 2008

Tags: PHP, Frage

einpraegsam.​net ·

Ich will Werte die per PHP aus der DB kommen über TS manipulieren können.
Auf http://wiki.typo3.org/index.php/TypoScript_-_PHP_Interaction ist das eigentlich gut beschrieben, wie man mit .field auf Felder aus PHP zugreifen kann:

$this->cObj->start($myRow, 'tx_mytable_images');
$myImgCode = $this->cObj->cObjGetSingle($conf['myImg'], $conf['myImg.']);
plugin.tx_myext_pi1 {
  myImg = IMAGE
  myImg {
    file.import = uploads/tx_myext/
    file.import.field = tx_myimagefield
# Also possible (remove above 2 lines):
#    file.import.dataWrap = uploads/tx_myext/{ field : tx_myimagefield }
    file.maxW = 400
  }
}

Das will aber nicht ums Verrecken laufen:

$this->cObj->start($row, 'tt_address');					
$markerArrayAll['###WTDIRECTORY_VALUE###'] = $this->cObj->cObjGetSingle($this->conf[$what.'.']['field.'][$value], $this->conf[$what.'.']['field.'][$value.'.']); // value

Ideen?

PS: Wohl eine Steffen Frage 😉

einpraegsam.​net ·

Der Fehler muss wohl bei mir liegen - wenn ich testweise eine Userfunc anlege:

<?php
	class user_test {
	
		function main($content='', $conf=array()) {
		
			$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery ( // DB query
				'*',
				'tt_address',
				$where_clause = '1 '.$this->cObj->enableFields('tt_address'),
				$groupBy = '',
				$orderBy = '',
				$limit = 1
			);
			if ($res) $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); // Result in array
			
			
			$this->cObj->start($row, 'tt_address');
			$x = $this->cObj->cObjGetSingle($conf['object'], $conf['object.']);
			return '<strong>test:</strong> '.$x;
			
		}
	
	
	}

?>

Dann funktioniert dieses TS einwandfrei:

includeLibs.user_301redirect = fileadmin/user_test.php

page.2 = USER
page.2 { 
   userFunc = user_test->main
   object = TEXT
   object.field = email
   object.typolink.parameter.field = email
}