Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-11-15 05:43:36

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

<txp:if_article_section> support for multiple sections?

Hi.
First, I dont know if this question belongs to here or to Feature Request.

Well, it’s all in the title.
Is it planed to add support for multiple sections to <txp:if_article_section>?

I find rare that txp:if_section supports multiple comma separated values, but the same isnt supported in txp:if_article_section.

Finally, I’m perceiving an effluvium of ideas that will be possible if this tag supports multiple comma separated values.

Thanks.

Last edited by maniqui (2005-11-17 13:42:42)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#2 2005-11-19 16:23:12

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

Re: <txp:if_article_section> support for multiple sections?

I give this a bump.

I’m having an effluvium of ideas but i need that this nice tag could support multiple comma separated sections…


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#3 2005-11-19 17:28:54

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

Re: <txp:if_article_section> support for multiple sections?

I guess someone should propose a patch to do this.

Offline

#4 2005-11-23 02:55:21

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

Re: <txp:if_article_section> support for multiple sections?

maniqui wrote: I’m having an effluvium of ideas but i need that this nice tag could support multiple comma separated sections…

I cant bite my tongue… errr… my fingers hard enough.

zem has anticipated my ¿upcoming? awesome (?) tutorial (it depends of this feature request to be implemented) in this FAQ, when he explains how to apply a special layout to articles from a particular section when shown on the front page.

If txp:if_article section could support multiple comma separated values for name attribute (as txp:if_section), we could achieve the following:

Tutorial: Txp:if_article_section: “Long live to ‘default’ article form”
(how to use “default” form to have per-section articles layouts)

In the “default” article form:
<div class="<txp:section />">
<txp:if_article_section name="recipes">
...some txp article tags... like txp:body, txp:title, etc, to have an special layout for section "recipes"
</txp:if_article_section>
<txp:if_article_section name="reviews">
...some txp article tags... like txp:body, txp:title, etc, to have an special layout for section "reviews"
</txp:if_article_section>
<!--"default" layout to all articles that doesnt belong to "recipes" nor "reviews" section-->
<!--all the trick is here and it's what this feature request is about -->
<txp:if_article_section name="articles,reviews">
<txp:else />
...some txp article tags... like txp:body, txp:title, etc, to have an special layout for *all the other sections*
</txp:if_article_section>
</div>

Pros:

  • multiple article layouts per-section in just one “default” form.
  • you dont have to create many forms for different layouts. Just stick to the “default” form, and maybe a few more, if necesary.
  • you dont have to declare the “form” attribute in txp:article ‘cause form="default" is default value when not declared, and still have different layouts.
  • all this is extensible to article forms for listform attribute (so you could have different article layouts per-section in article-list context.
  • also, this is extensible to txp:if_article_category, and both tags can be combined to have special layouts per-section and per-category
  • less calls to DB?

Cons?

  • performance impact?
  • anything else?

Just if someone is confused: this is not supported in 4.0.2. I’m suggesting this ideas just to clarify why I requested this feature.

Thanks!

Last edited by maniqui (2007-01-12 15:25:14)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#5 2005-11-23 03:51:34

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: <txp:if_article_section> support for multiple sections?

This would be handy to complete the set.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#6 2005-11-23 08:52:09

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: <txp:if_article_section> support for multiple sections?

This fairly simple nudge seems to work well enough for me, unless there is something I am missing?

<code> function if_article_section($atts, $thing) { global $thisarticle; extract(lAtts(array( ‘name’ => ‘’, ),$atts)); $section = $thisarticle[‘section’]; return parse(EvalElse($thing, in_list($section, $name))); }
</code>

Given a little testing, I’ll post it as a plugin.

Offline

#7 2005-12-05 23:10:53

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

Re: <txp:if_article_section> support for multiple sections?

@ rsilletti

your code seems to work perfectly, as long as I tested (well, not too much testing, but at least it worked in the frontpage).

But I dont think it worth the effort to release this as a plug-in. As Jeremie said, this should be a patch.

It would be nice that this simple change could be added to the core of TXP in the next release (4.0.3).

Also, I think this isn’t really a feature request, but more a suggestion to keep the logic inside TXP.
The first time I noticed this tag (txp:if_article_section) I was sure that it will work the same as txp:if_section, and others conditional tags. I mean, I though the tag would accept multiple values in the name attribute, as other tags.
I think that the lack of that support was simple a very little distraction of the developers.

Edit: I have forgotten something very important: to give the thanks to you, rsilletti! Thanks!

Last edited by maniqui (2005-12-06 00:48:25)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#8 2005-12-06 00:42:26

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: <txp:if_article_section> support for multiple sections?

I agree, its just a matter of tweaking it in.

Offline

#9 2005-12-12 17:11:10

Dufresne
Member
Registered: 2005-09-19
Posts: 22

Re: <txp:if_article_section> support for multiple sections?

This potential patch looks useful!

On a similar vain, has comma seperated <txp:if_section name =“blar, blar, blar”> been incorporated into 4.0.2?

I’ve seen a couple of threads on this with a hack but can’t seem to get it to work in 4.0.2 when i try.

Cheers,

Dufresne

Offline

#10 2005-12-12 17:27:50

Dufresne
Member
Registered: 2005-09-19
Posts: 22

Re: <txp:if_article_section> support for multiple sections?

Eureka!

After posting i continued my search and stumbled across John Hicks (pretty darn impressive) site and this article

I’d basically had spaces between my sections like so.

<code>
<txp:if_section name = “section, section2, section3”>
blar blar
</txp:if_section>
</code>

It should of been

<code>
<txp:if_section name = “section,section2,section3”>
blar blar
</txp:if_section>
</code>

Hope this saves other people time!

Dufresne

Keywords for search: if_section comma seperated

Last edited by Dufresne (2005-12-12 17:29:49)

Offline

#11 2006-02-11 20:43:06

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: <txp:if_article_section> support for multiple sections?

OK, I really need comma-seperated lists to be supported in if_article_category.

I tried to patch my taghandler file, kinda guessing based on the and if_article_sections hack but it throws up errors and I’m way out of my depth.

Seems like a pretty basic capability. Hope it makes it soon.

Offline

#12 2006-02-13 04:52:19

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: <txp:if_article_section> support for multiple sections?

My best shot at this one would be:
<a href=“http://textcastle.com/article/47/update-on-ifarticle-category”>Here</a>, I’ve included some tag examples that should make the line of thinking a little clearer.

A single tag may be workable, but even it you had it – it would be confusing to use. The tag combination approach allows for a name list to be used and different tag setups to be used.

Hope these work for you.

Last edited by rsilletti (2006-02-16 04:20:21)

Offline

Board footer

Powered by FluxBB