Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Do NOT show something if_article id="90", else show it
Hi,
I would like to show a sign-up button, except on the sign-up form which has article ID 90.
I am trying to use this code in my sidebar code (running in a form, type misc):
<txp:if_article id=“90”><txp:else /><a href=”/sign-up/”>Sign up</a></txp:if_article>
However, this leads to the link not being shown anywhere on my page.
Is there something wrong with that?
Thanks a lot,
Alex
Last edited by ar (2024-01-25 16:41:59)
Offline
Re: Do NOT show something if_article id="90", else show it
<txp:if_article_id id="90" not><a href=”/sign-up/”></txp:if_article_id>
should do the trick.
Offline
Re: Do NOT show something if_article id="90", else show it
Yes! Thank you very much! :-)
(I had missed to add _id.)
Edit 1:
Ok, this works on article pages, but not on the front page and on section pages. In those pages there is a “1” being shown.
Is there a way to circumvent this?
Edit 2:
<txp:if_individual_article><txp:if_article_id id=“90” not><a href=”/sign-up/”>sign up</a></txp:if_article_id><txp:else /><a href=”/sign-up/”>sign up</a></txp:if_individual_article>
This seems to work.
Last edited by ar (2024-01-25 17:06:41)
Offline
Re: Do NOT show something if_article id="90", else show it
ar wrote #336464:
I am trying to use this code in my sidebar code (running in a form, type misc):
This tag can only be used in article context, i.e.
- either on an individual article page
- or inside
<txp:article(_custom) />
tag or a form called by this tag.
Otherwise <txp:if_article_id />
will just throw a warning in debug mode. Probably, it is too zealous.
Offline