Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-10-12 16:28:22

brianlux0r
Member
Registered: 2007-06-04
Posts: 41

problem with <txp:if_article_id id=3>

Hi trying to include a misc form if a certain article is being pulled:

placed in default page (section uses this as template:

<txp:if_article_id id=3>
<txp:article limit=“1” form=“b-form” />
</txp:if_article_id>

this doesnt output anything! what am i doing wrong?

Offline

#2 2007-10-12 17:23:04

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

Re: problem with <txp:if_article_id id=3>

brianlux0r wrote:

<txp:article limit="1" form="b-form" />

If it’s a misc form you need to use <tpx:output_form />. Also wrap it in if_individual_article tags:

<txp:if_individual_article>
<txp:if_article_id id="3">
<txp:output_form form="b-form" />
</txp:if_article_id>
</txp:if_individual_article>

Offline

#3 2007-10-25 18:18:17

brianlux0r
Member
Registered: 2007-06-04
Posts: 41

Re: problem with <txp:if_article_id id=3>

ok i realized that if im calling just section url, althought im pulling a certain article with limit 1 for the particular section, my condition is not meeting for if article id = something, this will not work on a section page. how can i display a certain form based on the section, without having to create a new template page for only that section?

Offline

#4 2007-10-25 18:46:15

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: problem with <txp:if_article_id id=3>

Wrap that all with txp:if_section

Cheers!

Offline

#5 2007-10-26 16:50:26

brianlux0r
Member
Registered: 2007-06-04
Posts: 41

Re: problem with <txp:if_article_id id=3>

ok i have section-1 using default template. now section-1 uses article 3 for it’s content.

So when i call site.com/section-1 the form i want to be loaded based on the article id if, it is not loading:

inside default template i have:

<txp:if_individual_article>
<txp:if_article_id id=“3”>
<txp:output_form form=“b-form” />
</txp:if_article_id>
</txp:if_individual_article>

Offline

#6 2007-10-30 03:37:26

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: problem with <txp:if_article_id id=3>

That’s not an individual article page, so the article ID is never even checked. Also, on a non-individual article page, you have to put article related tags (including conditionals) inside an article form.

Offline

#7 2007-10-30 06:10:40

brianlux0r
Member
Registered: 2007-06-04
Posts: 41

Re: problem with <txp:if_article_id id=3>

yeah i was looking at it the wrong way. i cant access article data only from a section template file.

Offline

#8 2007-12-05 17:49:28

Anton
Plugin Author
From: Alingsås, Sweden
Registered: 2004-11-16
Posts: 138
Website

Re: problem with <txp:if_article_id id=3>

Is there a “if_article_id_less_than” available somewhere? As a plugin maybe?

Offline

#9 2007-12-05 19:06:05

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: problem with <txp:if_article_id id=3>

Anton,

I’m not aware of any, but you could use something like:

<txp:php>
echo (article_id() < 10) ? 'Hi, my name is article below-id-ten' : 'Hi, Im the other input';
<txp:php>

Cheers!

Last edited by Gocom (2007-12-05 19:10:49)

Offline

#10 2007-12-05 20:37:38

Anton
Plugin Author
From: Alingsås, Sweden
Registered: 2004-11-16
Posts: 138
Website

Re: problem with <txp:if_article_id id=3>

Thanx Gocom. I guess that’s what I’ll have to do. I was more looking for a way to display the excerpt field if show articles below a certain id (which has the excerpt in the body too) and just show the body for them. Using echo would (I guess) require adding extra queries. Or is the excerpt stored in the $thisarticle context at this point maybe?

Offline

#11 2007-12-06 04:56:06

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: problem with <txp:if_article_id id=3>

Nope, no extra queries. Just call excerpt(array()) (all Txp tags are functions).

Offline

Board footer

Powered by FluxBB