Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2008-01-07 14:11:29
- scdoody
- Member
- Registered: 2006-10-18
- Posts: 129
IF based on section name and form name?
Is it possible to use the <txp:if_section> tag and specify the section name AND the form name?
I want to do this because I have a page called “items”. I use two forms in conjunciton with this – “full” and “list”. If I am in the section “articles” and am using the page “items” and the form “list”, then I want to hide one area that otherwise displays on the page that uses the page “items” and the form “full”.
So how can I add conditions to a page with the same section but different forms?
Offline
Re: IF based on section name and form name?
I’m not sure if the current TXP page and form are exposed at any point to the client side. I could be wrong.
There’s probably another way of doing it — or another way of organising your site to achieve the same end — but in the absence of any higher wisdom you’re welcome to try the dirty old smd_if plugin in case there’s something you can grab hold of that would do the same thing. Ignore me.
Last edited by Bloke (2008-01-07 15:35:40)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#3 2008-01-07 15:29:57
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: IF based on section name and form name?
Couldn’t you use <txp:if_section>
inside the article form to achieve this?
Offline
#4 2008-01-12 13:45:51
- scdoody
- Member
- Registered: 2006-10-18
- Posts: 129
Re: IF based on section name and form name?
No I do not think I could not just use <txp:if_section> inside the article form to achieve this. I want the condition to happen on the page depending on which form is displayed.
I want to do this because I have a page called “items”. I use two forms in conjunciton with this – “full” and “list”. If I am in the section “articles” and am using the page “items” and the form “list”, then I want to hide one area that otherwise displays on the page that uses the page “items” and the form “full”.
So how can I add conditions to a page with the same section but different forms?
Offline
#5 2008-01-12 14:20:57
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: IF based on section name and form name?
I was thinking about something like this:
On the page ‘items’:
<txp:article form="full_or_list" />
Form ‘full_or_list’:
<txp:if_section name="articles">
<!-- your content of form 'list' -->
<txp:else />
<!-- your content of form 'full' -->
</txp:if_section>
But maybe I misunderstand you…
Offline
Re: IF based on section name and form name?
This one will show articles depending on at wich section we are:
<txp:if_section name="articles">
<txp:article form="form_for_article_section" />
</txp:if_section>
<txp:if_section name="list">
<txp:article form="form_for_list_section" />
</txp:if_section>
Last edited by the_ghost (2008-01-12 14:58:54)
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
#7 2008-01-12 14:59:21
- scdoody
- Member
- Registered: 2006-10-18
- Posts: 129
Re: IF based on section name and form name?
I should have pointed out that the content that I want to condition based on whether or not it is form full or form list is not actually on the ITEMS page – it is actually called via <txp:output_form form=“sidebar-right” /> – so perhaps my question really is this . . .
How can I put a condition in the for “sidebar-right” to change the display of content depending on if we are viewing the list of articles “via page ITEMS with form LIST” or a full article detail page “via page ITEMS with form FULL”
Offline
#8 2008-01-12 15:07:55
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: IF based on section name and form name?
Apologies for still not understanding completely :/ Should the condition be we are in section ‘articles’ or not OR we are on an article list page (in section articles) or on an individual article page?
Last edited by els (2008-01-12 15:08:23)
Offline
#9 2008-01-12 15:22:06
- scdoody
- Member
- Registered: 2006-10-18
- Posts: 129
Re: IF based on section name and form name?
We are in section articles are are viewing the list of articles. (page = ITEMS, form = article_list)
We are in sections articles and we are viewing a full detail of an article (page = ITEMS, form = article_full)
The articles page is two column. The left column is either the list or detail of an article. The right column has links and when you’re on the detail article page I want a quote to appear in the right column, but for the quote to NOT appear when you are viewing the list of articles. However, the right column is a form that’s included called sidebar-right.
Offline
Re: IF based on section name and form name?
Talking about the individual and article list difference :) So:
<txp:if_section name="articles">
<txp:if_individual_article>
<txp:article form="article_full" />
<txp:else />
<txp:article form="article_list" />
</txp:if_individual_article>
</txp:if_section>
Cheers!
Last edited by Gocom (2008-01-12 16:32:50)
Offline
#11 2008-01-12 16:46:26
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: IF based on section name and form name?
I’m not sure that is what scdoody means, Gocom.
scdoody
Sorry for not asking before, but can you tell us what the URLs of both these examples look like? (If Gocom’s post is not answering your question of course.)
We are in section articles are are viewing the list of articles. (page = ITEMS, form = article_list)
We are in sections articles and we are viewing a full detail of an article (page = ITEMS, form = article_full)
Offline
Re: IF based on section name and form name?
Els,
I’m neither, but that is what his writing says – or the clearly followable part says…
We are in section articles are are viewing the list of articles. (page = ITEMS, form = article_list)
We are in sections articles and we are viewing a full detail of an article (page = ITEMS, form = article_full)
How I understand this:
- Section is called
articles
- Case n.1: Were are on article list: Pagetemplate is ITEMS, and the article form is
article_list
. - Case n.2: We are on induvidual article: Pagetemplate is still ITEMS, but the article form is changed to
article_full
.
Cheers! ;)
Last edited by Gocom (2008-01-12 17:00:53)
Offline