Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » Archives
  3. » if_article?

#1 2006-03-17 08:00:36

frederik
Member
From: Denmark
Registered: 2004-12-08
Posts: 17

if_article?

Hi,
It’s possible to diplay conditional content via the if_section or if:category tag. Is there a similar tag to display conditional content for a single article – like: txp:if_article id=“4” ?
Maybe a plugin?

Thanks in advance!

/Frederik

Offline

#2 2006-03-17 08:39:10

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: if_article?

The usual way to do that would be to put the content in your article, perhaps in a custom field.


Alex

Offline

#3 2006-03-17 08:50:08

frederik
Member
From: Denmark
Registered: 2004-12-08
Posts: 17

Re: if_article?

What I want to achieve is to be able to highlight an article in a submenu. The same way as can be done using the if_section tag.

Example:

<code>
<txp:if_section name=“about”>
<li id=“active”><a href=”<txp:site_url />about/”>about</a></li>
<txp:else />
<li><a href=”<txp:site_url />about/”>about</a></li>
</txp:if_section>
</code>

I want to do the same with a single article. Of course I could just use a custom field and the if_custom_field tag – I was just wondering whether there was an if_article conditional tag.

Thanks for the help!

/Frederik

Offline

#4 2006-03-17 09:20:16

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: if_article?

Maybe you’d want to employ the method I have describe here.

It’s just a tiny splash of <txp:php> adding a class attribute to the “active”/“current” article for a second level navigation menu.

Last edited by wet (2006-03-17 09:20:29)

Offline

#5 2006-03-19 16:21:25

jessejericho
Member
Registered: 2005-10-29
Posts: 25

Re: if_article?

Is there any other way to accomplish this? I have three-level nav, and don’t want to use article_custom, however I do want to add an active class to my third level. I can’t use if_cat or if_section…

Offline

#6 2006-03-19 22:12:37

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

Re: if_article?

I’ve an if_article_id plugin available Here , but unlike if_category and if_section it needs to be in the article form.

Offline

#7 2006-03-20 03:00:52

jessejericho
Member
Registered: 2005-10-29
Posts: 25

Re: if_article?

Awesome, that worked perfectly! Thanks a lot rsilletti!

Offline

#8 2006-03-23 17:29:34

pedronx
Member
From: Poland
Registered: 2006-01-20
Posts: 18
Website

Re: if_article?

helo
but what should i do when i need if_article in page template, not the article form?

is there any solution to check which article is being watched and display additional content.?

Offline

#9 2006-03-23 17:48:31

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

Re: if_article?

hi pedronx,
what are you trying to achive?

I think you can create an article form with some conditional “if_article_id” inside, and then call it from the page template using <txp:article form="myconditionalform" />

In this case, you will need to turn off the “auto-append comment form” in the Site Preferences.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#10 2006-03-23 19:11:22

pedronx
Member
From: Poland
Registered: 2006-01-20
Posts: 18
Website

Re: if_article?

uhaaaaaaaaaaaaaaaaa
super
it works perfectly!!!!!!
thank a lot
BR

<code>
<txp:ras_if_article_id select=“10”>
<dl><dt>Motywacja</dt>
<dd><ul><txp:article_custom category=“motywacja” form=“submenu” sortdir=“asc” /></ul></dd></dl>
</txp:ras_if_article_id>

</code>

Offline

#11 2006-03-23 19:23:02

pedronx
Member
From: Poland
Registered: 2006-01-20
Posts: 18
Website

Re: if_article?

but…;)
is there any other option do that (taht didn’t work but this example showing exactly what i need):

txp:ras_if_article_id select=“10,11,12”

Last edited by pedronx (2006-03-24 15:59:07)

Offline

  1. Index
  2. » Archives
  3. » if_article?

Board footer

Powered by FluxBB