[TYPO3-english] userFunc condition

Dmitry Dulepov dmitry.dulepov at gmail.com
Tue Sep 8 19:55:53 CEST 2009


Hi!

Pero Matic wrote:
> Can you please (or someone else) then explain me this. I can't get it from 
> doc. When i have ie some object like this
> 
> 20 = COA
> 20.10 something bla bla
> 20.20 bla bla
> 20.30 if {
>     value = foo
>     equals = bar
>     negate = 1
> }
> 
> Does this mean that if condition is false than object 20 will not exist or 
> i'm totaly in different universe?

The object will always exists. Whether it shows anything or not, depends on the object. Some object even do not have "if" property.

Here is how you "decode" it using TSRef. You look to object's type. Suppose that:

	20.30 = TEXT
	20.30 {
		if {
			equals = bar
			negate
			value = foo
		}
		value = House M.D
	}

So you got TEXT. You look to TSRef at [1] and see that it has "value" and "the stdWrap is on the very rootlevel of the object". It is clear about "value", so stdWrap remains.

Next you go to stdWrap at [2] and look for "if". It says two things. Firsts it is "->if", which means you need to look up "if" in TSRef. Secondly, stdWrap will return an empty string if result of the "if" is false. if stdWrap returns empty result, TEXT will return empty result.

Next we go and look to "if" at [3] and see that "equals" returns false if it is not equal to "value". In your case it is not equal, so the result should be "false". But there is also "negate", which negates false to true and "if" returns true. This means that the TEXT object will display the content of the "value", which "House M.D".

Now change the first line from TEXT to HTML. There will be absolutely not effect of the "if" because there is no stdWrap on the root level and "if" is not processed at all. See how it works?

[1] http://typo3.org/documentation/document-library/core-documentation/doc_core_tsref/4.2.1/view/1/8/#id4365499 
[2] http://typo3.org/documentation/document-library/core-documentation/doc_core_tsref/4.2.1/view/1/5/#id4269096 
[3] http://typo3.org/documentation/document-library/core-documentation/doc_core_tsref/4.2.1/view/1/5/#id4289528 

-- 
Dmitry Dulepov
Facebook: http://www.facebook.com/dmitryd
Twitter: http://twitter.com/dmitryd
Skype: liels_bugs


More information about the TYPO3-english mailing list