Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-10-25 14:30:45

kvnmcwebn
Member
From: Ireland
Registered: 2007-01-27
Posts: 724
Website

first time using categories need a bit of help

hi i have a category list here:

http://soathar.macdesign.eu/en/Galleries

Clicking on any of the links in the list returns an url like this but wont produce and article.

http://soathar.macdesign.eu/en/category/Cosan-Glas-05

hmmm…

not sure how to handle section to be used and the article tags link to it.

Last edited by kvnmcwebn (2008-10-25 14:52:37)


its a bad hen that wont scratch itself.
photogallery

Offline

#2 2008-10-25 15:26:19

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: first time using categories need a bit of help

How are you creating the category list Kevin?


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#3 2008-10-25 16:12:48

kvnmcwebn
Member
From: Ireland
Registered: 2007-01-27
Posts: 724
Website

Re: first time using categories need a bit of help

hi stuart,
well im using the site nav tag generator, ive tried all of the tags attributes but the only one thats generating a list is:

<txp:category_list wraptag=“ul” break=“li” class=”“ />

edited for spelling

Last edited by kvnmcwebn (2008-10-25 16:13:30)


its a bad hen that wont scratch itself.
photogallery

Offline

#4 2008-10-25 16:20:45

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: first time using categories need a bit of help

Add the attribute this_section="1" to the tag to keep the links within the Galleries section. See if that works.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#5 2008-10-25 23:14:28

kvnmcwebn
Member
From: Ireland
Registered: 2007-01-27
Posts: 724
Website

Re: first time using categories need a bit of help

ok wait im starting to see how this works.
stuart if i use this_section=“1” would i then use something like this on the section page:

<txp:if_individual_article>
<txp:article form=“default” />
<txp:else />
<txp:category_list wraptag=“ul” break=“li” class=”“ this_section=“1” />
</txp:if_individual_article>

im not even going to try this without asking first…

its a bad hen that wont scratch itself.
photogallery

Offline

#6 2008-10-26 09:41:30

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: first time using categories need a bit of help

If you do that Kevin what will happen is that if viewing an “individual_article” page you will see the article but if you are viewing an “article_list” page you will get the category list only. An “article_list” page would include any section front-page that uses that particular page template. Is that what you are after?

I’m thinking that in order to get to the individual article in the first place you need a link to it, so somewhere in your page you will need to be able to list the article titles contained in the category. I’m not sure how you are laying out your page but generally something like a category list would appear in the sidebar so that when a visitor selects a category the main content of the page changes to an article list from that category. You can see that method at work here. Of course the category list could appear anywhere on your page but it needs to be in combination with the code necessary to display the articles once a category link has been selected so take a look at this:-

<txp:if_individual_article>
<txp:article />
<txp:else />
<txp:if_category>
<txp:article limit="4" form="formName" />
</txp:if_category>
<txp:category_list wraptag="ul" break="li" class="" this_section="1" />
</txp:if_individual_article>

This will do the same as your original code but also, when a category link has been selected, it will display the articles from that category. The category listing will still be shown. I have it under the article list but you could move it above. When someone visits the section front-page for the first time they will only see the category list. How you display the category articles will determine whether you also need paging links. You may for instance decide to use a form that only displays the linked titles in which case you can get the full list onto a single page (no paging links required) or you may decide to show excerpts or even the full articles in which case the paging links will probably be necessary.

Also, just to keep the code to a minimum, if you are using the “default” form you don’t need to specify it in the tag.

Last edited by thebombsite (2008-10-26 10:25:43)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#7 2008-10-27 16:15:25

kvnmcwebn
Member
From: Ireland
Registered: 2007-01-27
Posts: 724
Website

Re: first time using categories need a bit of help

hi stuart.

thats working well thank you.
I wanted to try and put the category list on top of the article so i tried this:

<txp:if_category> <txp:article /> <txp:else /> <txp:if_individual_article> <txp:article form="aro" /> </txp:if_individual_article> <txp:category_list wraptag="ul" break="li" label="Cosan Glas Archives" labeltag="h2" class="navcontainer" this_section="1" parent="Cosan-Glas" /> </txp:if_category>

Its seems to be working ok.

Actually theres another small issue, the category list is generating an empty li.
I thought its was because of the parent=”“ attribute in the category list tag, but when i assigned an article to the parent category it was still there.

Last edited by kvnmcwebn (2008-10-27 16:19:11)


its a bad hen that wont scratch itself.
photogallery

Offline

#8 2008-10-27 16:34:04

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: first time using categories need a bit of help

kvnmcwebn wrote:

Actually theres another small issue, the category list is generating an empty li.
I thought its was because of the parent=”“ attribute in the category list tag, but when i assigned an article to the parent category it was still there.

I assume you don’t want to include the parent category in your list? Then try:

<txp:category_list wraptag="ul" break="li" label="Cosan Glas Archives" labeltag="h2" class="navcontainer" this_section="1" parent="cosan-glas" exclude="cosan-glas" />

BTW change your category names to all lowercase. Capitals in category and section names can sometimes cause problems.

Offline

#9 2008-10-27 17:11:15

kvnmcwebn
Member
From: Ireland
Registered: 2007-01-27
Posts: 724
Website

Re: first time using categories need a bit of help

cheers els


its a bad hen that wont scratch itself.
photogallery

Offline

#10 2008-10-27 17:17:49

kvnmcwebn
Member
From: Ireland
Registered: 2007-01-27
Posts: 724
Website

Re: first time using categories need a bit of help

one more really embarrassing question.
i thought i had clean urls going.
is this a category clean url:
http://soathar.macdesign.eu/en/galleries/?c=Cosan-Glas-05

Last edited by kvnmcwebn (2008-10-27 18:15:59)


its a bad hen that wont scratch itself.
photogallery

Offline

#11 2008-10-27 17:38:37

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: first time using categories need a bit of help

That’s as clean as it gets with plain Txp ;) But you can have /section/category URLs with gbp_permanent_links.

Offline

Board footer

Powered by FluxBB