Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-03-12 08:56:02

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Add new attr break_class to article_custom and edit attr "break"

1. I rather often use break classing and in this ocasions i have to set break="" and manualy write both break tags and classes inside form.

Was:

<txp:article_custom section='<txp:section />' limit="999" break="" wraptag="ul" class="article_links">
  <li <txp:if_last_article>class="last"</txp:if_last_article>>
    <a <txp:if_article_id>class="active"</txp:if_article_id> href="<txp:permlink />"><txp:title /></a>
  </li>
</txp:article_custom>

Become:

<txp:article_custom section='<txp:section />' limit="999" break="li" break_class='<txp:if_last_article>class="last"</txp:if_last_article>' wraptag="ul" class="article_links">
  <a <txp:if_article_id>class="active"</txp:if_article_id> href="<txp:permlink />"><txp:title /></a>
</txp:article_custom>

2. And another thing, that make me a little nervous is default break value set to br. Is it possible – if i use article_custom as container, break attr by default is set to "" (NULL)? Current behaviour ir really unexpected to me now..


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#2 2009-08-28 13:13:59

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: Add new attr break_class to article_custom and edit attr "break"

Again spent an hour finding why <br /> appeared… Could this behaviour be changed?


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#3 2009-08-28 13:38:42

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

Re: Add new attr break_class to article_custom and edit attr "break"

While we are here and without wanting to hijack this thread, may I suggest another attribute that come in handy, particularly on article and article_custom?

wrapid="myListofArticles"

Why? Currently, if I want to set an id to the wraptag, the only way is by not using wraptag, and hardcode it, wrapping the txp:tag.
In doing it that way, if there is no output, the HTML end ups with an empty pair of wrapping tags.
Of course, there is the chance of doing the txp:variable/txp:if_variable dance to check if there is any output first… but that is a real hassle.

Last edited by maniqui (2009-08-28 13:39:00)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#4 2009-08-28 19:24:39

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

Re: Add new attr break_class to article_custom and edit attr "break"

the_ghost wrote:

2. And another thing, that make me a little nervous is default break value set to br. Is it possible – if i use article_custom as container, break attr by default is set to "" (NULL)? Current behaviour ir really unexpected to me now..

Oh what?! I just edited the Textbook entry to change the default value to unset, but I didn’t know there’s a different default value for the single tag… I agree with you, Victor, that this is very confusing behaviour.

Edit: it’s not true. Default value is empty either way.

Last edited by els (2009-08-28 19:30:28)

Offline

#5 2009-08-28 19:32:38

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

Re: Add new attr break_class to article_custom and edit attr "break"

maniqui wrote:

Of course, there is the chance of doing the txp:variable/txp:if_variable dance to check if there is any output first… but that is a real hassle.

if_first/last_article would be easier I think?

Offline

#6 2009-08-28 19:48:09

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

Re: Add new attr break_class to article_custom and edit attr "break"

Hi Els,
you are right, I think it will do the job, at the expense of cluttering pages/forms with two extra sets of conditionals.
The attribute would still be nice…


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB