[TYPO3-content-rendering] [Typo3-dev] Less features, more future

JoH info at cybercraft.de
Fri Oct 14 13:41:23 CEST 2005


>>>> <div class="single_imagecontainer" id="tt_content_123_1_1">
>>>> <div class="single_imagecontainer" id="tt_content_124_1_2">
>>>> <div class="single_imagecontainer" id="tt_content_125_1_3">
>>>> <div class="single_imagecontainer" id="tt_content_125_2_4">
>>>> <div class="single_imagecontainer" id="tt_content_123_1_5">
>
>>> How to assure this, when dealing with different content elments,
>>> different extensions maybe?
>
>> First case: Different content elements
>> Look at the above example.
>> You have 3 different content elements. One of them is used twice
>> another one contains two images.
>> Since we are using a counter for each element that is getting a
>> dynamic id this seems to be no problem.
>
> Why don't we then just use a single random unique ID, if there is no
> real way to predict which id an element will get? This way we don't
> need any counter. We already have a function to generate such
> unique-ids for a certain page, its called: $TSFE->uniqueHash().

Of course we could do that, but I thought it's more comfortable to have
"speaking ids" while debugging the CSS files.
Maybe this can be useful for other things too.
But you are right: In the first place the id has to be just unique.
Everything else is nice to have but not a must.

>> Second case: different extensions
>> If the extension author wants to create dynamic CSS entries to the
>> same file, he simply has to use the same counter.
>> So we could get things like:
>>
>> <div class="single_imagecontainer" id="tt_content_123_1_1">
>> <div class="news_singleView_imagecontainer" id="tt_news_456_1_2">
>> <div class="single_imagecontainer" id="tt_content_124_1_3">
>> <div class="myextension_whatever_imagecontainer"
>> id="myextension_whatever_789_1_4">
>> <div class="single_imagecontainer" id="tt_content_125_2_5">
>> <div class="single_imagecontainer" id="tt_content_123_1_6">
>
> An extention author could use the uniqueHash() function, place the
> "id" on the needed tag and then add the "dynamic" css style to the
> page ($TSFE->setCSS). This can already be done, not?
>
> The only missing part would be to have setCSS respect
> inlineStyle2TempFile so that this would get to an external temporary
> .css file.
>
>> The only thing that has to be done is to provide this counter as a
>> register with autoincrement on a per page base.
>> To enable/disable this behaviour for elements, we could use a
>> TypoScript parameter like
>>
>> dynamicCSS_entry = 1
>> dynamicCSS_entry.prefix = myprefix
>>
>> This will trigger a function that increments the counter, gets the
>> tablename, some additional prefix and the uid.
>> Then it creates a string with some underlines and assigns this as
>> the id of the element.
>
> It looks like this is something the extention should be doing. Or do
> you need any change to the TYPO3-core for this to work?

Well - it would be nice to get something like this from stdWrap so that an
admin could assign additional dynamic CSS values to other content elements
too.
For extension developers this would mean they have to use the same stdWrap
function to assign their values. Just to make things as compatible as
possible.

Something like

temp.whatever = COA
temp.whatever {
    stdWrap.dynamicCSS_entry = 1
    stdWrap.dynamicCSS_entry {
        tag = <div>
        baseClass = imagecontainer
        params.cObject = COA
        params.cObject {
            text-align = TEXT
            text-align.field = fieldname
            width = TEXT
            width.data = whatever
            width.wrap = |px
        }
    }

This would generate an output like

<div class="imagecontainer" id ="asdf87699876asdf2">
    #Rest of the COA including wrap, innerWrap, outerWrap etc.
</div>

and the appropriate style in the CSS file

#asdf87699876asdf2 {
            text-align = left;
            width = 128px;
}

Of course you wouldn't have to use cObject for the params when you are using
the function inside your own PHP stuff.
Simply populate an array and you're done.

What do you think?

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your knob sometimes!)
Dieter Nuhr, German comedian
openBC: http://www.openbc.com/go/invuid/Jo_Hasenau





More information about the TYPO3-project-content-rendering mailing list