[TYPO3-templavoila] TypoScriptObjectPath and lib.something = USER

Uschi Renziehausen typo3news at otherone.de
Sun May 13 12:10:14 CEST 2007


Hello TVs :)

Can you please help me with a problem assigning a USER-object to a 
TypoScriptObject Path?

In my project, i need to find out the uid of the next page up in 
rootline that has the field layout=1. This uid I want to assign to the 
special.value of a HMENU with special = list. After trying hard to find 
a mere ts solution, I finally gave up and switched to a little PHP-script:

The php-code:

<?php
/**
  * Fetches the ID of the next portal start page up in rootline.
  * We know that we have a portal start page, when the layout field is 
set to 1
  */
class user_getPortalId {
	var $cObj;// The backReference to the mother cObj object set at call time
	
	function main($content,$conf){
		$countLevels=count($GLOBALS["TSFE"]->rootLine);
		for($i=$countLevels;$i>0;$i--) {
			if($GLOBALS["TSFE"]->rootLine[$i]["layout"]==1) {
				return $GLOBALS["TSFE"]->rootLine[$i]["uid"];
			}
		}
		return "";
	}
}
?>



Now, in my DS I have a <h1>-element with editing type 
TypoScriptObjectPath set to lib.shared_portaltitle.


For testing purposes my TS looks like this:
includeLibs.user_getPortalId = fileadmin/scripts/user_getPortalId.php
lib.shared_portaltitle = USER
lib.shared_portaltitle.userFunc = user_getPortalId->main

This way, I do not get any output at all, and in the admin panel there 
is the following error message: Function "" was not prepended with "user_"

If I put the following TS directly into the DS, i get the correct output:
<field_portaltitle type="array">
<tx_templavoila type="array">
	<title>Portaltitel</title>
	<sample_data type="array">
		<numIndex index="0">[Portaltitel]</numIndex>
	</sample_data>
	<eType>none</eType>
	<TypoScript><![CDATA[

10=USER
10.userFunc=user_getPortalId->main

]]></TypoScript>
	</tx_templavoila>
</field_portaltitle>


Am I generally disallowed to use USER object in TypoScriptObjectPath or 
what else is wrong?

Have a nice Sunday, Uschi


More information about the TYPO3-project-templavoila mailing list