[TYPO3] TS: userfunc with result of select

Dmitry Dulepov [typo3] dmitry at typo3.org
Thu Sep 4 20:14:59 CEST 2008


Hi!

Boris Degenhardt wrote:
> after reading some Stuff i do understand that i can get the content of 
> an CONTENT Element through cObjGetSingle, but for me its not clear how 
> to pass it trough my TS, how do the TS look like??

temp.v3User = TEMPLATE
temp.v3User {
	...
}

temp.startUser = CONTENT
temp.startUser {
	...
	renderObj = COA
	renderObj {
		# Store uid in the register for future use
		10 = LOAD_REGISTER
		10.fe_user_uid.field = uid
		# Show the output
		20 < temp.v3User
		# Clean up
		30 = RESTORE_REGISTER
	}
}

includeLibs.usericons = fileadmin/template/php/usericons.php
temp.icons = USER
temp.icons {
	userFunc = user_icons->getIcons
	# Below is TS object to get data from the register
	user = TEXT
	user.data = register:fe_user_uid
}


In the code:

function getIcons($content, $conf) {
	$cObj = t3lib_div::makeInstance('tslib_cObj');
	$cObj->start(array());
	$result = $cObj->cObjGetSingle($conf['user'], $conf['user.']);
}

And once more: do not use COA unless you really need it. I suggest also to read these parts of TSRef:
- about "register: whatever"
http://typo3.org/documentation/document-library/references/doc_core_tsref/4.1.0/view/2/2/
- about stdWrap and ".field"
http://typo3.org/documentation/document-library/references/doc_core_tsref/4.1.0/view/5/1/
- about LOAD_REGISTER
http://typo3.org/documentation/document-library/references/doc_core_tsref/4.1.0/view/8/18/

-- 
Dmitry Dulepov
TYPO3 Core team
My TYPO3 book: http://www.packtpub.com/typo3-extension-development/book
In the blog: http://typo3bloke.net/pages/book-reviews/presentation-zen-by-garr-reynolds/


More information about the TYPO3-english mailing list