Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2017-08-01 06:01:26
- raminrahimi
- Member
- From: India
- Registered: 2013-03-19
- Posts: 278
check if i'm on the main page of each section
I’ve three sections (India, USA, Canada) and created each page (template) for each section, now i want:
when i’m on the main page of each section, want to appear a slider of each country,
example if the page url is:
http://localhost/india
(india slider will appear)
http://localhost/usa (usa
slider will appear)
http://localhost/canada
(canada slider will appear)
i tried with this, but didn’t answer 100% what i want
<txp:variable name="home" value='<txp:page_url />' />
<txp:if_variable name="home" value='/cananda/'>
slider...
note: i don’t want to see the slider on any other pages like individual article, category, search, pagination, author
Offline
Re: check if i'm on the main page of each section
I think that glx_if is still working just fine. It provides tags like: <glx_if_section_frontpage />
.
If you are trying to do it without a plugin, could you please tell us how you would like the site to work? ie Do your sections have pagination when you are in an article list environment?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: check if i'm on the main page of each section
<txp:if_section name="india,usa,canada">
<txp:if_individual_article>
<txp:else />
<!-- slider here -->
</txp:if_individual_article>
</txp:if_section>
aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)
Offline
#4 2017-08-01 11:58:11
- raminrahimi
- Member
- From: India
- Registered: 2013-03-19
- Posts: 278
Re: check if i'm on the main page of each section
i can do that by long codes to add on each page (template) of section like the following, but i think it’s not professional way:
<txp:if_search>
<txp:if_author>
<txp:if_category>
<txp:if_individual_article>
<txp:else />
... my-slider ...
</txp:if_individual_article>
</txp:if_category>
</txp:if_author>
</txp:if_search>
Offline
Re: check if i'm on the main page of each section
raminrahimi wrote #306506:
i can do that by long codes to add on each page (template) of section like the following, but i think it’s not professional way
Why would you need a page per section? And what is wrong with your <txp:if_variable name="home" value='/canada/'>
approach?
Offline
Re: check if i'm on the main page of each section
<txp:if_article_list>
...
</txp:if_article_list>
<txp:if_individual_article>
...
</txp:if_individual_article>
Offline
Re: check if i'm on the main page of each section
raminrahimi wrote #306506:
i can do that by long codes to add on each page (template) of section like the following, but i think it’s not professional way:
This has been my solution for that. I like everything highly modular.
<txp:variable name="task" value="frontpage" />
<txp:if_category><txp:variable name="task" value="category" /></txp:if_category>
<txp:if_search><txp:variable name="task" value="search" /></txp:if_search>
<txp:if_author><txp:variable name="task" value="author" /></txp:if_author>
<txp:output_form form='task-<txp:variable name="task" />' />
Offline
#8 2017-08-02 16:17:15
- raminrahimi
- Member
- From: India
- Registered: 2013-03-19
- Posts: 278
Re: check if i'm on the main page of each section
etc wrote #306507:
Why would you need a page per section? And what is wrong with your
<txp:if_variable name="home" value='/canada/'>
approach?
why would you need …
i’ve different styles because of that different page per section.
what is wrong with …
because if someone write without /
(http://localhost/canada) it will not run that variable.
people write sometime with /
and sometime without that, like:
http://localhost/canada
http://localhost/canada/
Offline
#9 2017-08-02 17:01:06
- raminrahimi
- Member
- From: India
- Registered: 2013-03-19
- Posts: 278
Re: check if i'm on the main page of each section
i just found a good solution :-)
<txp:variable name="main" value='<txp:page_url type="id" />-<txp:page_url type="q" />-<txp:page_url type="c" />-<txp:page_url type="author" />-' />
<txp:if_variable name="main" value="----">
...slider...
</txp:if_variable>
Offline