Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-06-08 20:26:27

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

wraptag & break attributes, and a feature request

Some days ago user darok asked in this forum about the concept of wraptag
It’s a concept fairly easy to understand, it doesn’t need too much explanation, I think.

So, I was about to write an example and I thought about using txp:custom_field to exemplify about the wraptag attribute.
But when checked at the TextBook for the attributes supported by that tag, I found that it doesn’t have the wraptag attribute.

So, let’s go first with the feature request: add wraptag to txp:custom_field.
Example:
<txp:custom_field name="book_title" wraptag="p" />.

Currently, if you want to achieve the same results (and, at the same time, avoid having an empty tag if custom field is empty), you have to do this:

<txp:if_custom_field name="book">
<p><txp:custom_field name="book"></p>
</txp:if_custom_field>

——-

Back to the wraptag attribute. I checked the list of txp tags that currently support that attribute.
Nothing wrong with it, but I just would like to point to an example when the wraptag attribute isn’t necessary (if I’m not wrong).
I’m not saying that it should be removed (that would definitely have backward-compatibility issues).
For example, <txp:section />.

That tag will always return something (ie. you are always on a section), right?.
So, there is no need for attribute tag. (Of course, in upcoming 4.0.7, with the new parser, you could add a complex construct of txp tags inside the wraptag attribute… but not sure if you will find a real word use for that…)

——

Now, about the break attribute. Yesterday, I was “shocked” when I discovered that you can use other strings (not just valid HTML tags, like p, div) as a value for the break attribute… well, at least, it worked in txp:zem_event_categories tag.

I did: <txp:zem_event_categories break=", " />, and then, in the output, I’ve got:
category-a, category-b, category-c.
cool! :D

Question: Is this something valid for txp built-in tags and/or any other plugin tag that supports break? Or is just something for zem_event_categories?


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#2 2008-06-08 22:23:21

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: wraptag & break attributes, and a feature request

Question: Is this something valid for txp built-in tags and/or any other plugin tag that supports break?

Yep – break accepts any kind of input.

Offline

#3 2008-06-08 22:53:57

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: wraptag & break attributes, and a feature request

I found out that you can also use txp tags in wraptag :)

<txp:comments_form wraptag="txp:if_comments_allowed" />

does exactly the same as

<txp:if_comments_allowed>
<txp:comments_form />
</txp:if_comments_allowed>

Offline

#4 2008-06-08 23:05:31

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: wraptag & break attributes, and a feature request

=D

Deserves the price for the most creative use of a wraptag EVER!!
New tag parser (reverted)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#5 2008-06-09 09:01:13

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: wraptag & break attributes, and a feature request

Very creative, but it takes more processing power to parse the page that way and you’ll find that sometimes using this trick doesn’t behave as you’d expect ;)

Offline

#6 2008-06-09 15:09:50

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: wraptag & break attributes, and a feature request

I wasn’t going to use it :)

Offline

Board footer

Powered by FluxBB