Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Go to Category section from wherever
Hi, well, I don’t know if the title is right, but it is all I come with.
The trouble (introduction)
I use the tag ‘category_list’ in every page of my site. So I have a category list in statics and live articles.
The trouble (trouble)
When I’m on a page called Contact Us, or History and click on the category’s name I can’t see the Category page and their content… I just see the same page but with ?c=Conciertos added on the direction bar.
Ok, I know this can not be a trouble if I have <txp:if_category /> on every single page… (static or live)
But, I think that add <txp:if_category /> tag in all my pages… will be a waste of time, and What If I decide to change it tomorrow?
The trouble (solution)
There is a way to redirect or… (I don’t know how to say it) all the category links to the same (or a unique section, called, maybe ‘category’) section? So I could click on a Category link and go to the respective Category section…?
I hope you understand me! (Sorry for my Bad English, but I try)
Thanks in advance!
Offline
#2 2009-02-24 17:38:41
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Go to Category section from wherever
robhert wrote:
There is a way to redirect or… (I don’t know how to say it) all the category links to the same (or a unique section, called, maybe ‘category’) section? So I could click on a Category link and go to the respective Category section…?
You probably have this_section="1"
in your category_list tag? That would be the cause that all category pages are displayed on the current section page. You can either display all category pages on the front (default) page, you have to leave the this_section
and section
attributes out of your category_list tag then. Or you can, like you said, display them on a ‘category’ section page, in that case use <txp:category_list section="category" /
. You will need an article_custom tag on that ‘category’ section page that looks like this:
<txp:article_custom category='<txp:category />' />
NOTE: I’m not sure if you are supposed to use ‘category’ as a section name, because it is also used in the URLs of category pages (site.com/category/your-category). If it doesn’t work try ‘categories’ or something else.
Offline
Re: Go to Category section from wherever
Hi Els, thank you for your help and answer.
I have this tag in the Category column:
<txp:category_list wraptag="ul" break="" class="catlist">
<txp:variable name="hasarticle" value='<txp:article_custom category=''<txp:category />'' limit="1" />' />
<txp:if_variable name="hasarticle" value="">
<txp:else />
<li><txp:category title="1" link="1" class='<txp:if_category name=''<txp:category />''>current</txp:if_category>' /></li>
</txp:if_variable>
</txp:category_list>
So I don’t know, where I’m saying to TXP that I want to see the category in the current page. Could you help me with this? So I could have the categories section or page in other side…
Thanks in advance!
Last edited by robhert (2009-02-26 17:49:56)
Offline
#4 2009-02-26 22:31:39
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Go to Category section from wherever
robhert wrote:
So I don’t know, where I’m saying to TXP that I want to see the category in the current page.
You are right, I don’t know why it is using the current section with the tag used like this. Strange…
But if you want to use a section ‘categorias’ to display the category pages this should work:
<txp:category_list wraptag="ul" break="" class="catlist" section="categorias">
<txp:variable name="hasarticle" value='<txp:article_custom category=''<txp:category />'' limit="1" />' />
<txp:if_variable name="hasarticle" value="">
<txp:else />
<li><txp:category title="1" link="1" class='<txp:if_category name=''<txp:category />''>current</txp:if_category>' /></li>
</txp:if_variable>
</txp:category_list>
The links to the category pages would then look like site.com/categorias/?c=conciertos. On your page for section ‘categorias’ (or wrapped in <txp:if_section name="categorias">
tags) something like this:
<h2>Articles in category <txp:category title="1" /></h2>
<txp:article_custom category='<txp:category />' />
with ?c=Conciertos added on the direction bar.
Don’t use capitals in category (or section) names!
Offline
Re: Go to Category section from wherever
Hi Els, you are the best!
I have done all you said, since change the category names (I’m not using Capitals anymore) to add section="categorias"
tag in <txp:category_list />
. But with no success.
In frontpage, and articles page I see /categoría/festivales
when I mouseover the link Festivales category, and the link works. But when I’m on Historial, Staff or Contact Us page, when I mousover the link Festivales I see /contacto/?c=festivales
but always it tries to show Category in the current page…
I’ll PM my url.
Thanks in advance
Offline
#6 2009-02-27 23:51:17
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Go to Category section from wherever
It looks like the category_list tag you posted above is only on the page template used by your front page (default?), and I am quite sure that your category_list tag on the section page(s) has a this_section="1"
attribute, is it possible that you are looking at the category_list tag on the wrong page template?
You can also check (in Presentation > Sections) if you assigned the right pages to your sections.
Tip: install smd_where_used and search for this_section="1"
.
Offline
Re: Go to Category section from wherever
Hi Els,
Thanks for your time. I have done all you said. First I saw in and I’m using the same tag in all my pages, in fact, I’m using a form to call the box of the Category list:
<h2 class="nobtop">Categorías</h2>
<div class="ctopleft"><txp:output_form form="categorias-lista"/></div>
And I have this in the form:
<txp:category_list wraptag="ul" break="" class="catlist" section="categorias">
<txp:variable name="hasarticle" value='<txp:article_custom category=''<txp:category />'' limit="1" />' />
<txp:if_variable name="hasarticle" value="">
<txp:else />
<li><txp:category title="1" link="1" class='<txp:if_category name=''<txp:category />''>current</txp:if_category>' /></li>
</txp:if_variable>
</txp:category_list>
with name= categorias-lista and Misc of type.
I have installed the plugin and looked for: this_section="1"
but I have found nothing in Sections, Page, forms and articles.
I think it’s weird. But… please keep helping me :D
Regards
Offline
#8 2009-02-28 01:23:49
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Go to Category section from wherever
Problem found. It was not in the category_list tag, but in the category tag inside it, by default it links to the current section… So the section="categorias"
had to be added to the txp:category tag, not to the category_list tag.
So, I learned something new today: if you use category_list as a container tag (or with a form I assume) you can add section
or this_section="0"
attributes as much as you like, but it will always be overridden by the txp:category tag inside.
Last edited by els (2009-02-28 01:26:04)
Offline
#9 2009-06-25 16:34:41
- alarius
- Member
- Registered: 2009-05-28
- Posts: 45
Re: Go to Category section from wherever
hi.
you found the problem…
but how to solve it?
Offline
#10 2009-06-25 21:27:06
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Go to Category section from wherever
alarius, does this thread help?
Offline
#11 2009-06-26 15:49:56
- alarius
- Member
- Registered: 2009-05-28
- Posts: 45
Re: Go to Category section from wherever
sorry, Els, it doesn’t…
I’d like to build (without plugin) a category menu that output me all the articles in order of section on the page, not only the articles of that category in the curren section
Offline
#12 2009-06-26 16:00:25
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Go to Category section from wherever
Sorry, I don’t think I understand… Can you give an example of how it should look like?
Offline