Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2024-01-25 16:39:28

ar
Member
From: Nuremberg, Germany
Registered: 2012-03-08
Posts: 45
Website

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

#2 2024-01-25 16:42:23

giz
Member
From: New Zealand
Registered: 2004-07-26
Posts: 304
Website GitHub Twitter

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

#3 2024-01-25 16:48:31

ar
Member
From: Nuremberg, Germany
Registered: 2012-03-08
Posts: 45
Website

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

#4 2024-01-25 18:26:18

etc
Developer
Registered: 2010-11-11
Posts: 5,236
Website GitHub

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

Board footer

Powered by FluxBB