---
title: "Verständnisfrage: $this->cObj->start und .field"
url: "https://www.typo3.net/d/80851-verstaendnisfrage-this-cobj-start-und-field"
source: "typo3.net"
tags: ["Extensions","Entwicklung","Frage","PHP"]
created: "2008-08-20"
last_reply: "2008-08-20"
replies: 1
solved: false
page: 1
pages: 1
lang: "de"
---

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

Extensions › Entwicklung · 1 Antwort · gestartet 2008-08-20

## Eröffnungsbeitrag

**einpraegsam.​net** · 2008-08-20 · [Beitrag #1](https://www.typo3.net/d/80851-verstaendnisfrage-this-cobj-start-und-field/1)

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:

```php
$this->cObj->start($myRow, 'tx_mytable_images');
$myImgCode = $this->cObj->cObjGetSingle($conf['myImg'], $conf['myImg.']);
```

```typoscript
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:

```php
$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 ;)

## Antworten

### [#2](https://www.typo3.net/d/80851-verstaendnisfrage-this-cobj-start-und-field/2) · einpraegsam.​net · 2008-08-20

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

```php
<?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:

```typoscript
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
}
```

---

Quelle: „Verständnisfrage: $this->cObj->start und .field“, typo3.net, https://www.typo3.net/d/80851-verstaendnisfrage-this-cobj-start-und-field
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
