Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-01-30 00:04:03

mrjysta
Member
Registered: 2008-09-22
Posts: 89

Change page headline when displaying particular category list

Hey peeps, below is currently what I am using to generate my headline on my template. So I currently get a different headline depending on what article I’m on. Problem is I need the headline to change to something different again when the mainpage displays a particular category list. eg <txp:if_category name=“female”><h2>female</h2> <txp:else /> <h2>male</h2> etc…

I have tried to include an additional <txp:if_category> under the existing <txp:else /> below but this just renders 2 titles.

How do I integrate an additional <txp:if_category> into the existing statement?

maybe I need a plug-in?

<div id=“headline”> <txp:if_individual_article> <txp:article form=“bass_heading” /> <txp:article form=“bass_tabs” /> <txp:else /> <txp:article status=“sticky” form=“bass_heading” /> </txp:if_individual_article> <txp:article form=“bass_tabs” />
</div><!— headline end —>

Last edited by mrjysta (2009-01-30 00:10:18)

Offline

#2 2009-01-30 01:03:00

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

Re: Change page headline when displaying particular category list

Does this do what you want?

<div id="headline">
	<txp:if_individual_article>	
		<txp:article form="bass_heading" />
		<txp:article form="bass_tabs" />
	<txp:else />
		<txp:if_category>
			<txp:if_category name="female">
				<h2>female</h2>
			<txp:else />
				<h2>male</h2>
			</txp:if_category>
		<txp:else />
			<txp:article status="sticky" form="bass_heading" />
		</txp:if_category>
	</txp:if_individual_article>
	<txp:article form="bass_tabs" />
</div><!-- headline end -->

Offline

#3 2009-01-30 10:25:03

mrjysta
Member
Registered: 2008-09-22
Posts: 89

Re: Change page headline when displaying particular category list

Looks good to me Els but I got the following error on one of the else tags:
Tag error: <txp:else/> -> Textpattern Warning: tag does not exist on line 983

Offline

#4 2009-01-30 15:18:07

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

Re: Change page headline when displaying particular category list

Did you copy my example exactly? Otherwise, could you post the code you have? This error often indicates that a closing conditional tag is missing.

Offline

#5 2009-01-30 17:48:43

mrjysta
Member
Registered: 2008-09-22
Posts: 89

Re: Change page headline when displaying particular category list

Hmm, yes I copied it exactly/

Any other ideas?

Offline

#6 2009-01-30 18:08:37

mrjysta
Member
Registered: 2008-09-22
Posts: 89

Re: Change page headline when displaying particular category list

Sorted: thanks for pointing me in the right direction Els/

<div id="headline">
		<txp:if_individual_article>	
			<txp:article form="bass_heading" />
			<txp:article form="bass_tabs" />
		<txp:else />
			<txp:if_category name="Female">
				<h2>female</h2>
			<txp:else />
				<txp:if_category name="Male">
					<h2>male</h2>
				<txp:else />
				<txp:article status="sticky" form="bass_heading" />
				</txp:if_category>
			</txp:if_category>
		</txp:if_individual_article>

		<txp:article form="bass_tabs" />
	</div><!-- headline end -->

Last edited by mrjysta (2009-01-30 18:14:32)

Offline

#7 2009-01-30 18:19:18

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

Re: Change page headline when displaying particular category list

Hmm… now I have to figure out why my code was wrong… Glad you sorted it :)

Offline

#8 2009-02-03 20:48:46

mrjysta
Member
Registered: 2008-09-22
Posts: 89

Re: Change page headline when displaying particular category list

Damn! Thought that works but after some more testing the if_else is not working/ Gone down a more simple route:

Form:
<txp:if_individual_article>
<txp:article form=“bass_heading” />
<txp:else />
<txp:if_category>
<txp:article status=“sticky” form=“bass_heading” />
</txp:if_category>
<txp:article status=“sticky” form=“bass_heading” />
</txp:if_individual_article>

<txp:article form=“bass_tabs” />

But the <txp:if_category> doesn’t seem to work when doing a category article listing e.g.(http:sitename.com/section/?c=Female)
Also if leave it without the <txp:if_category> everytime the homepage displays http:sitename.com/section/?c=Female the headline from form(bass_heading) disappears !

I feel like im missing something fundemental in the way that TXP works

Offline

#9 2009-02-03 21:45:44

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

Re: Change page headline when displaying particular category list

EDIT: have a look at my post in your other thread. I think that misunderstanding may also play a part here :)

Last edited by els (2009-02-03 21:57:28)

Offline

#10 2009-02-03 23:16:08

mrjysta
Member
Registered: 2008-09-22
Posts: 89

Re: Change page headline when displaying particular category list

:-O no wonder i’ve been having problems! – thanx again Els/

Last edited by mrjysta (2009-02-03 23:16:41)

Offline

Board footer

Powered by FluxBB