[TYPO3-english] userFunc condition

Peter Klein peter at umloud.dk
Tue Sep 8 13:54:54 CEST 2009


Hi Sergio.

Conditions can be used outside of confinements (curly braces) only! 
The TYPO3 documentation is a mess, so it's quite hard to find the
correct document.  (Back in the old days, there was a comment function
on the TSRef pages, where users could put extra info like this, but
that got removed when the "new" layout was introduced.)

The condition usage is descriped in "TypoScript Syntax and In-depth
Study" 
http://typo3.org/documentation/document-library/core-documentation/doc_core_ts/4.2.0/view/1/2/#id4124614

A more appropriate place would have been in TSRef, or a link in TSRef
pointing to the other document.

--
Peter Klein / Umloud Untd.



On Tue, 08 Sep 2009 13:41:23 +0200, Sergio Catalá Gil
<scatala at iti.upv.es> wrote:

>Hi, 
>
>I've got the next code:
>
>######### TS #########
>includeLibs.pf = fileadmin/class.user_functions.php
>
>plugin.tt_news.genericmarkers {
>  	pk = USER
>	pk {
>		[userFunc = user_functions->user_compare_dates]
>			10 = TEXT
>			10.value = Subscribe
>		[else]
>			10 = TEXT
>			10.value = Closed (can't subscribe)
>		[end]
>	}
>}
>######### TS #########
>
>### fileadmin/class.user_functions.php ###
><?
>
>class user_functions {   
>
>  function user_compare_dates($content, $conf) {
>
>    echo "Function executed";
>    // Opened course  
>    if
>($this->cObj->data['generic_tx_mblnewsevent_inscription_end_date'] >
>strtotime(now))  
>      return true;  
>    
>    // Closed course 
>    else    
>      return false;
>  } 
>    
>}    
>     
>?>
>### fileadmin/class.user_functions.php ###
>
>It seems: if I put "userFunc" in a condition, the function isn't
>executed. Could you tell me why? Instead, if I try the next code
>(userFunc without a condition):
>
>plugin.tt_news.genericmarkers {
>  	pk = USER
>	pk {
>		userFunc = user_functions->user_compare_dates
>	}
>}
>
>the function gets executed. 
>
>What am I doing wrong? :-(
>


More information about the TYPO3-english mailing list