[TYPO3-content-rendering] Smart Content Rendering (was: Re: [Typo3-dev] Less features, more future)

JoH info at cybercraft.de
Mon Oct 24 12:27:47 CEST 2005


>> This brings me to the major issue when it comes to a new concept of
>> "smart content rendering".
>
> I agree with you, that the way most of the TYPO3 extensions render
> their content is far from perfect, because separation between the
> main logic of the extension and the layout is often not there at all.

We are not talking about extensions here. It's about the core elements like
TEXT, COA, IMAGE, IMGTEXT ...

>> 1. No hardcoded [..] tags in the PHP files [..]. They should be
>> replaced with TypoScript settings.
>
> Do you think of something like the following here?
>
> plugin.tx_myext_pi1 {
>    globalWrap = <div><ul>|</ul></div>
>    imgWrap = <li>|</li>
>    captionWrap = <p>|</p>
>    captionBeforeImg = 1
> }
>
> IMHO that is not intuitive to use, because all the properties' names
> like "globalWrap" are "invented" by the extension author and have to
> be learnt or looked up by the user.

Well - it's all about backwards compatibility. If there has been hardcoded
HTML in a content element before, the behaviour must stay the same for every
new rendering type we would create.
So if there was something like <table><tr><td>|</td></tr></table> for a
certain element, it must be still there, but with the possbility to switch
it off. The only easy way of doing this is TypoScript.

> Apart from that, it also restricts the user to a certain order of
> things.

No it doesn't ;-)
See below ->

> A better way would be using the ###MARKER### template way:
>
> <div>
>      <ul>
>        <!-- ###ROWS### begin -->
>          <li>
>             <!-- ###IMAGE### -->
>             <!-- ###CAPTION### -->
>          <li>
>        <!-- ###ROWS### end -->
>      </ul>
> </div>
>
> But even that way restricts you in how you can output your content,
> because they are not "intelligent".

No it doesn't ;-)
See below ->

> Imagine you'd like to output your content in a table like this:
>
> <tr> ITEM1 ITEM2 ITEM3  </tr>
> <tr> ITEM4 ITEM5 ITEM6  </tr>
> <tr> ITEM7 ITEM8  </tr>
>
> (<td> tags are left out to make reading easier. Imagine them around
> the items.)
>
> This won't work with ###MARKER### templates for two reasons:
>   - you can't make it begin a new <tr> row each two rows.
>   - you can't make it output colspan="2" for the last item
>
> In order to fix the first problem, you could ask the extension author
> to create TS properties "useRows = 1" and "itemsPerRow = 3", but IMHO
> the main extension logic PHP should not worry at all about the layout.
>
> What we need is a "smart" way of content rendering, that is as simple
> to use as the ###MARKER### way for simple scenarios, but can cope
> with more advanced "layout logic" too.

Yes - and the magic word is: "templated wraps" + optionSplit
If there was the possibility to select the part(s) that is/are used as a
wrap from a template all the possible problems you described above could be
solved.

For example in a menu you could do something like this:

allWrap.fromTemplate = 1
allWrap =
|*|NEWROW1||1COL||1COL||LASTCOL||NEWROW2||1COL||1COL||LASTCOL|*|NEWROWLAST||
1COL||2COL

NEWROWX and XCOL could be defined in the template.

If we would introduce optionSplit for every wrap not just for menus and
split, and if we would improve the functionality a bit, this could do a lot
of the "layout logic".
You could wrap content elements to follow a layout like this

HEADER_ELEMENT_3_COLUMNS
CONTENT || CONTENT || CONTENT
SUBHEADER_2_COLUMNS || NEWSHEADER
CONTENT || CONTENT || NEWSLIST_XROWS
|*|CONTENT||CONTENT|*|
FOOTER

The definitions for the different subparts would be taken from a template.
I would prefer something like this instead of using the XML-overhead of the
TV-concept.

> I think PHP offers pretty much all to build something like that.

Yes - since we would have to create the base for these templated wraps in
PHP.
Just an idea that has of course to be improved, but I think it could be a
new way of doing things.


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