Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-09-19 00:45:58

kewlboyee
New Member
Registered: 2009-09-18
Posts: 4

How do I NOT output a form when a specific article is displayed?

Yes, I am a newb. So, I want this form “kmc_secondary_courses” to be outputted in all cases except when a specific article is being displayed. Here is the code for the page template:

<!— content —>
<div id=“content”>

<txp:output_form form=“kmc_secondary_courses” />

<div id=“content_primary”> <txp:if_individual_article> <txp:article status=“sticky” /> <txp:article /> <txp:else /> <txp:article status=“sticky” /> </txp:if_individual_article> </div>

<txp:output_form form=“kmc_content_features” />
</div><!— / #content —>

I could make that article have a special category and use <txp:if_article_category name=”???”> but I still can’t figure it out since the form is outputted before the article.

Thanks.

Offline

#2 2009-09-19 01:16:17

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

Re: How do I NOT output a form when a specific article is displayed?

Wrap it on <txp:if_article_id id="XX"></txp:if_article_id>, where XX is the number (id) corresponding to the article where you don’t want to display the form.

Last edited by maniqui (2009-09-19 01:22:07)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#3 2009-09-22 00:43:08

kewlboyee
New Member
Registered: 2009-09-18
Posts: 4

Re: How do I NOT output a form when a specific article is displayed?

So you mean like this?

<!— content —>
<div id=“content”>

<txp:if_article_id id“250”>
<txp:output_form form=“kmc_secondary_courses” />
</txp:if_article_id>

<div id=“content_primary”> <txp:if_individual_article> <txp:article status=“sticky” /> <txp:article /> <txp:else /> <txp:article status=“sticky” /> </txp:if_individual_article> </div>

<txp:output_form form=“kmc_content_features” />
</div><!— / #content —>

Because that does the opposite, that outputs the form ONLY for the article with the ID=“250”. Am I missing something?

Offline

#4 2009-09-22 00:47:23

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

Re: How do I NOT output a form when a specific article is displayed?

Almost there:

<txp:if_article_id id="250">
<txp:else />
<txp:output_form form="kmc_secondary_courses" />
</txp:if_article_id>

La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#5 2009-09-22 00:53:32

kewlboyee
New Member
Registered: 2009-09-18
Posts: 4

Re: How do I NOT output a form when a specific article is displayed?

Thanks! But, for some reason now the form is not output at all.

Offline

#6 2009-09-22 01:08:22

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

Re: How do I NOT output a form when a specific article is displayed?

Ops.
If you have copied the code from my post above, then the problem is that I wrongly used typographical (curly) quotes on attributes, and that’s probably the reason you were getting no output at all.

I’ve fixed the code above, try it again.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#7 2009-09-22 01:11:11

kewlboyee
New Member
Registered: 2009-09-18
Posts: 4

Re: How do I NOT output a form when a specific article is displayed?

Yay, that worked. Thanks so much!

Offline

Board footer

Powered by FluxBB