Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-09-22 16:56:03

CodeWalker
Member
From: Hampshire, UK
Registered: 2010-01-08
Posts: 110
Website

Custom Category Page

I want to use a custom category display layout. Ive made a section called “category” and assigned it a “category” page, yet it still insists on using the default page to display urls like domain.com/category/somecat

Im sure ive done this before. What am i missing??!

Thanks!

Last edited by CodeWalker (2013-09-22 16:56:24)

Offline

#2 2013-09-22 19:42:06

milosevic
Member
From: Madrid, Spain
Registered: 2005-09-19
Posts: 390

Re: Custom Category Page

You don’t need a new section for that. On your actual page template:

<txp:if_category>
Your code for category pages
<txp:else/>
Your code for other situations like home,articles, search pages,etc,
</txp:if_category>

Note that you can control several situations directly from your default section page template with

If_category
If_search
If_author
If_individual_article

Etc.

This tags nested and using in conjuction of if/else structures will allow you to control what to do depending on what kind of page the user is visiting.

Last edited by milosevic (2013-09-22 19:52:07)


<txp:rocks/>

Offline

#3 2013-09-22 19:49:50

CodeWalker
Member
From: Hampshire, UK
Registered: 2010-01-08
Posts: 110
Website

Re: Custom Category Page

Thanks, I am aware i can do that, but i want a custom layout thats different to the default page. the html structure is different and It would be very difficult to use the default page.

Is there a way?

Last edited by CodeWalker (2013-09-22 19:50:00)

Offline

#4 2013-09-22 19:56:52

etc
Developer
Registered: 2010-11-11
Posts: 5,396
Website GitHub

Re: Custom Category Page

CodeWalker wrote:

I want to use a custom category display layout. Ive made a section called “category” and assigned it a “category” page, yet it still insists on using the default page to display urls like domain.com/category/somecat

Have you tried to replace category by some other name ?

Offline

#5 2013-09-22 20:02:10

milosevic
Member
From: Madrid, Spain
Registered: 2005-09-19
Posts: 390

Re: Custom Category Page

I guess no. Categories arte not asigned to any section so the default section controls It presentation.

You can try to pass the control of category pages presentation to a form instead of another page template starting your default page template with the if_category and calling a form instead a page:

<txp:if_category>
<txp:output_form form=“your-categories-template”/>
<txp:else/>
Here your actual default page markup.
</txp:if_category>

Last edited by milosevic (2013-09-22 20:02:46)


<txp:rocks/>

Offline

#6 2013-09-22 20:11:48

CodeWalker
Member
From: Hampshire, UK
Registered: 2010-01-08
Posts: 110
Website

Re: Custom Category Page

etc – it has to be called category as this is where Textpattern take you when you click on a category link. Im trying to customise how textpattern displays the list of articles in a category

milosevic – i understand, but i cannot do this because i would like a different HTML structure. If i use the form to do it, txp will generate html in the wrong place.

Last edited by CodeWalker (2013-09-22 20:12:12)

Offline

#7 2013-09-22 20:35:23

etc
Developer
Registered: 2010-11-11
Posts: 5,396
Website GitHub

Re: Custom Category Page

Ah, yes, stupid me. But what Jorge means seems to have sense:

<!DOCTYPE html>
<txp:if_category>
	<html>...</html>
<txp:else/>
	<html>...</html>
</txp:if_category>

Offline

#8 2013-09-23 02:44:50

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,477

Re: Custom Category Page

etc – it has to be called category as this is where Textpattern take you when you click on a category link. Im trying to customise how textpattern displays the list of articles in a category.

Are you sure you understand the difference between sections and categories?

Then, you can customize everything what you want.

At the moment I don’t understand, what you need to do. For example, you can create a section and select “on front page” “no”. Then you give the section its own template (page).

Offline

Board footer

Powered by FluxBB