[TYPO3-core] RFC #10011: New feature: TypoScript Condition to check for installed extensions

Franz Holzinger franz at ttproducts.de
Sat Dec 27 10:51:06 CET 2008


Hello Michael and benni,

> I agree completely. Additionally, consider that there is the "userFunc"
> condition type that could be used for such special cases...
> 
> - michael

IMHO the userFunc is not very helpful in many cases. It forces users to 
program their own PHP function. Many users want to solve their issues 
with TypoScript and without additional programming.
However if you are sure this is wrong, then I will remove this patch 
request.

> Benjamin Mack schrieb:
>> Hey Franz,
>>
>> can you give an example where you want to use this?

I want to use this with tt_products 2.8.0. . It has a field 'tax' which 
can have the tax of a product. However this field is not usable any more 
if you want to use the same TYPO3 shop for different countries or 
states. Each shop location might have different taxes. If you ship in 
Canada, then the tax depends on the province where the store is located 
and on the province where the buyer is located.
So I have improved the extension static_info_tables_taxes which has been 
extracted from static_info_tables. And I have changed tt_products to 
have a new field 'tax_id' which is a select box for the tax level in TCE.
The normal setup for the frontend must include the tax field, but if you 
have installed 'static_info_tables_taxes', then you want to use the more 
enhanced tax feature. And the field 'tax_id' must be read instead of 
'tax'. Now I do not want to bother the user about these details. I want 
to change the default settings of tt_products that it will automatically 
select the correct fields from the tt_products table.

plugin.tt_products.conf.tt_products.ALL.requiredFields = 
uid,pid,category,price,price2,directcost,graduated_price_uid,tax,inStock
[extLoaded = static_info_tables]
plugin.tt_products.conf.tt_products.ALL.requiredFields = 
uid,pid,category,price,price2,directcost,graduated_price_uid,tax_id,inStock
[global]

But I can only do this if this is supported by the TypoScript 
conditions. And I prefer not to add yet another extension to the TYPO3 
TER only for adding the condition about an installed extension. This 
might be usefull also to other TYPO3 extensions.
Alternative: Write into the document, that the users must add this line 
into their setup. Otherwise the extension won't work correctly any more. 
This could lead to SQL errors in the FE.

>> I tried to come up with a use-case and that was the first one that came
>> to my mind:
>>
>> [extLoaded = realurl]
>>   config.tx_realurl_enable = 1
>> [GLOBAL]
>>
>> and then I thought that if
>>
>> config.tx_realurl_enable = 1
>>
>> is on and the extension is not installed, that nothing would ever
>> happen, so it doesn't do any harm to have it without the condition.
>>
>> If extensions would use this in their own TypoScript files that come
>> with their plugins, this wouldn't make a lot of sense as well, as the
>> static templates would only be included once they are installed and
>> explicity added.

This is needed if an extension1 includes improvementes which rely on the 
installation of a different extension2. And the exension1 should still 
work even without the extension2 being installed.

Just consider the different address tables:
fe_users
tt_address
tx_party_addresses

And there are many more of them. Then you could write a different output 
depending on the address table which is being used.

>> I see, however, that it could be powerful when writing a generic
>> TypoScript for websites, or if an extension adds functionality to
>> another extension, so e.g. when comments are added to the TypoScript of
>> tt_news, tt_news could have prepared some conditions what to add when
>> comments are installed. But again, in this case I thought: Well, if
>> comments would ship automatically with a static template for this, and
>> you only add it once comments is installed, we're again good to go :).
>>
>> All the best,
>> benni.

No, because if the comments extensions is written in a general mode, so 
it could be used even for other extensions, then it won't have tt_news 
specific code. The code for smaller and not so important extensions 
whould still be missing. And even the comments extension should not add 
code to TypoScript if tt_news is not installed. This could lead to bugs.


And there is another use case:

You want to prepare an advanced TypoScript locally where you install 
extension1. Then you want to put this TypoScript to the live site before 
you install extension1. Another person is responsible to install 
extension1. He can do this later when he has time or done other bug 
fixes. The first person does not have to wait any more for the second 
person to be ready. And the live site will be working with and without 
an installed extension1. Chances to end up in a SQL error message will 
be smaller.


- Franz


More information about the TYPO3-team-core mailing list