[TYPO3-english] userFunc condition
Pero Matic
takoje at takoje.hr
Tue Sep 8 14:09:57 CEST 2009
While condtions are the main subject these days and no one wants to reply on
my thread maybe i can try here :-)
if my_var = 10
20 = COA
20 ....
else
20 = TEXT
20 ...
can someone show me how to make this in TS? I can't use [ ] conditions, only
if property. Thx!
"Peter Klein" <peter at umloud.dk> wrote in message
news:mailman.1.1252410894.21183.typo3-english at lists.netfielders.de...
> 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