Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2006-01-06 14:29:20
- aanimo
- New Member
- Registered: 2006-01-06
- Posts: 3
Conditional section?
Is there a way that I could show an excerpt of an article, or the body, based on what section the article belongs to? I searched the tags, but didn’t find any if_section=’” type of tag.
Thanks!
Offline
#2 2006-01-06 16:06:13
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Conditional section?
Offline
#3 2006-01-06 16:29:48
- KurtRaschke
- Plugin Author
- Registered: 2004-05-16
- Posts: 275
Re: Conditional section?
I think <txp:if_article_section name="">
might be more applicable here.
-Kurt
kurt@kurtraschke.com
Offline
#4 2006-01-06 22:08:59
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Conditional section?
KurtRaschke wrote:
I think
<txp:if_article_section name="">
might be more applicable here
You’re right, I’m sorry. txp:if_article_section
Offline
#5 2006-01-06 22:14:58
- aanimo
- New Member
- Registered: 2006-01-06
- Posts: 3
Re: Conditional section?
Thanks!
Oddly, when I place this:
< txp:if_article_section name=“blog”>
< txp:article />
< txp:else />
< h3>< txp:title /> ·
< txp:permlink>Read Article< /txp:permlink>< /h3>
< /txp:if_article_section>
in a form, then when it is called it outputs the articles twice. Any idea why?
Last edited by aanimo (2006-01-06 22:16:21)
Offline
#6 2006-01-06 22:31:53
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Conditional section?
txp:article is not for use in an article form, it should be used in the page template. Replace it in the form with what parts of the article you want to display, for instance
<code>
<txp:title />
<txp:body />
</code>
Offline
#7 2006-01-06 23:00:28
- aanimo
- New Member
- Registered: 2006-01-06
- Posts: 3
Re: Conditional section?
I knew that. . .argh. Sorry — totally slipped my mind
Last edited by aanimo (2006-01-06 23:00:44)
Offline
#8 2006-01-09 11:05:04
- -P-
- Member
- From: Finland
- Registered: 2005-09-10
- Posts: 211
Re: Conditional section?
I´m little confused about how to show same if_section content in multiple pages. I did look the manual but wasn´t able to get it work
so what I need to do is show in the sidebar form
<code><txp:if_section name=”“,about,faq,article>
<h3>Contact us</h3>
<p>…</p>
<txp:else />
</txp:if_section></code>
But don`t understand where should I add <code>”</code>
Offline
#9 2006-01-09 14:43:42
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Conditional section?
P wrote:
But don`t understand where should I add <code>”</code>
I’m not sure if I understand what it is you want to do. If you want to include the default section, you use
<code>
<txp:if_section name=”,about,faq,article”>
</code>
If you don’t need to display anything if it’s not one of those four sections, you can leave out the <txp:else />
.
Offline
#10 2006-01-09 15:03:40
- -P-
- Member
- From: Finland
- Registered: 2005-09-10
- Posts: 211
Re: Conditional section?
Thank you! Sometimes the obvious isn´t obvious. At least to me :D
Got totally confused when read the manual and there were these <code>name=“section name(,section name 2,…)” </code> so I tested zillion ways to put there<code>(</code> and <code>)</code> and <code>”</code>.
What I wanted to achieve here is to show in the sidebar “you can contact us…” in all the other pages except on the actual contact-page. Works now.
Offline
#11 2006-01-09 15:47:29
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Conditional section?
To make it easier in case you should add sections in the future, you could also do this:
<code>
<txp:if_section name=“contact”>
<txp:else />
your content here
</txp:if_section>
</code>
Offline
Pages: 1