Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2009-02-03 16:14:38
- jammer
- Member
- Registered: 2009-01-13
- Posts: 36
Category Links
I know there’s a probability this question has been asked before, but I cannot find the answer anywhere.
I created my Categories, and I link them to respective Sections through the articles I write. When I view the website, click on the Section link and view the articles, the articles appear just fine.
When I click on the category link at the end of the article however, I get an empty page with only the Category title at the top.
Can someone please help me. I would like the articles for that Category/Section to be listed when I click these Category links.
Is there a way I can do that.
Thanks….
MJ
Offline
#2 2009-02-03 16:44:48
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Category Links
I think the solution in this thread will help you.
Offline
#3 2009-02-03 17:44:23
- jammer
- Member
- Registered: 2009-01-13
- Posts: 36
Re: Category Links
Thanks for your response.
I’ve done all that following all the instructions, but the Category List and the Articles appear on the same page.
Also, when I click on one of the Categories, the article list for the Category I click on appear below the list of Section/Categories…
on that same page instead of on a page of its own.
This happens when I put the <txp:article > tag in the “Page” I use to call up the respective Section.
MJ
Offline
#4 2009-02-03 19:01:18
- jammer
- Member
- Registered: 2009-01-13
- Posts: 36
Re: Category Links
I also notice that clicking on a Category Link from the FrontPage, gives the exact result I’m trying to get,
but clicking on a Category link from a Section Page results in a page with ONLY the Category Title.
MJ
Offline
#5 2009-02-03 21:20:43
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Category Links
jammer wrote:
I’ve done all that following all the instructions, but the Category List and the Articles appear on the same page.
Also, when I click on one of the Categories, the article list for the Category I click on appear below the list of Section/Categories… on that same page instead of on a page of its own.
Can you post the code you have on that page? You’ll probably need a couple of conditional tags.
I also notice that clicking on a Category Link from the FrontPage, gives the exact result I’m trying to get, but clicking on a Category link from a Section Page results in a page with ONLY the Category Title.
The section
attribute to link to a category page for a particular section can be used both in <txp:category1 />
(+category2) as <txp:category_list />
.
Offline
#6 2009-02-04 00:17:19
- jammer
- Member
- Registered: 2009-01-13
- Posts: 36
Re: Category Links
Here is the code…
<txp:category_list parent=’<txp:section />’ exclude=’<txp:section />’
this_section=“1”
label=“Categories”
type=“article”
break=“li”
wraptag=“ul”
/>
<txp:if_section>
<txp:if_category name=’<txp:category />’>
<txp:article_custom category=’<txp:section />’ form=“article_listing” />
<txp:else />
<txp:article_list />
</txp:if_category>
<txp:else />
</txp:if_section>
It loads everything properly, it just loads everything on the same page
MJ
Offline
#7 2009-02-04 00:53:22
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Category Links
Would this do what you want?
<txp:if_section>
<txp:if_category name='<txp:category />'>
<txp:article_custom category='<txp:section />' form="article_listing" />
<txp:else />
<txp:category_list parent='<txp:section />' exclude='<txp:section />'
this_section="1"
label="Categories"
type="article"
break="li"
wraptag="ul"
/>
</txp:if_category>
</txp:if_section>
<txp:article_list />
is not an existing tag. What did you want it to do?
Offline
#8 2009-02-04 01:28:27
- jammer
- Member
- Registered: 2009-01-13
- Posts: 36
Re: Category Links
“<txp:article_list /> is not an existing tag. What did you want it to do?”
I was just trying something out with that because with “<txp:article />” in that location, I get the exact result of the code you suggested.
With your code, I get the a list of the Category articles. What I want to get is a listing of all the Categories in a particular Section, then when I click on a particular category, THEN I get a page returned with the articles.
So when I click on say..“Meat” Section, I get a list of Categories of say..“Chicken, Beef, Pork”. Then when I ckick on Category “Chicken”, I get a list of all articles under category “Chicken”.
Is there a way I can get that done…
Thanks
MJ
Offline
#9 2009-02-04 16:24:49
- jammer
- Member
- Registered: 2009-01-13
- Posts: 36
Re: Category Links
Hello,
Can anyone please help me out with this problem. I’ve been trying but I keep getting the same result every time.
Thanks
MJ
Offline
#10 2009-02-04 18:01:02
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Category Links
jammer wrote:
What I want to get is a listing of all the Categories in a particular Section, then when I click on a particular category, THEN I get a page returned with the articles.
Where do you want that list of categories? Because what my code does, is display the list of categories on a section page, and, when a category is clicked, display the articles in that category on the section page. Try replacing it with this (should do the same as far as I can see):
<txp:if_section>
<txp:if_category>
<txp:article form="article_listing" />
<txp:else />
<txp:category_list parent='<txp:section />' exclude='<txp:section />'
this_section="1"
label="Categories"
type="article"
break="li"
wraptag="ul"
/>
</txp:if_category>
</txp:if_section>
If you want it on the front page, just remove the if_section tags at the beginning and end of the code (but then the parent='<txp:section />' exclude='<txp:section />'
part won’t work).
Last edited by els (2009-02-04 18:02:33)
Offline
#11 2009-02-04 22:48:05
- jammer
- Member
- Registered: 2009-01-13
- Posts: 36
Re: Category Links
Thank you soooooooo much. Works exactl how I want it to work. Now I just have to clean up my code a bit.
I’m still puzzled however, as to why the “category” tags at the bottom of each article yeilds a blank page when clicked on…?
Thanks again…
MJ
Offline
#12 2009-02-04 23:16:47
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Category Links
jammer wrote:
I’m still puzzled however, as to why the “category” tags at the bottom of each article yeilds a blank page when clicked on…?
It would help if you told which tags are generating the links to those blank pages… But my guess is, that it’s <txp:category1 />
and <txp:category2 />
in your article form that need an attribute section
or this_section
.
Offline