Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2009-04-13 22:40:51

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

Re: problem with combined section/category/article navigation

woy wrote:

I now just get all the articles in the list, after opening an article.

Do you mean that you’re not only getting the articles in the same category as the individual article, but actually all articles? Damn, that means my code isn’t working as I thought it would. Can you post the part of the tag trace that comes just before the [Baustein: content_link] part? I mean the part regarding this code:

<txp:if_individual_article>
<txp:article_custom category='<txp:category1 />,<txp:category2 />' form="content_link" wraptag="ul" class="content_nav" />
</txp:if_individual_article>

Is there a way around to hide or skip all the articles where [<txp:if_article_id>: false] applies?

Is this your article form ‘content_link’?

<li<txp:if_article_id> class="active"</txp:if_article_id>><a href='<txp:permlink />'><txp:title /></a></li>

The if_article_id is checking for the article currently viewed, to apply the ‘active’ class. I’m sure I must be missing something, but why would you want to skip the other articles?

Offline

#14 2009-04-13 22:55:56

woy
Member
Registered: 2009-04-08
Posts: 18

Re: problem with combined section/category/article navigation

Yes, that’s how my content_link-form looks.

<txp:output_form form="content_nav" />
	[SQL (9,5129013061523E-5): select Form from txp_form where name='content_nav']
	[Baustein: content_nav]
	<txp:if_category>
		[<txp:if_category>: false]
	</txp:if_category>
	<txp:if_individual_article>
		[<txp:if_individual_article>: true]
		<txp:article_custom category='<txp:category />' form="content_link" wraptag="ul" class="content_nav" />
			[attribute 'category']
			<txp:category />
			[/attribute]
			[SQL (0,00053596496582031): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') order by Posted desc limit 0, 10]
			[Artikel 15]
			[SQL (9,4890594482422E-5): select Form from txp_form where name='content_link']

I hope that’s the right snippet. When you head to http://www.bekolut.de/produkte/?c=polare-sorbentien and click on an article below the category-navigation, you get all articles. But when I head back to the category, the list is correct.

Offline

#15 2009-04-13 23:05:49

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

Re: problem with combined section/category/article navigation

category='<txp:category />'

This should be category='<txp:category1 />,<txp:category2 />' (inside the if_individual_article tags).

Offline

#16 2009-04-13 23:16:03

woy
Member
Registered: 2009-04-08
Posts: 18

Re: problem with combined section/category/article navigation

Mh, doesn’t fix it. I had removed ,<txp:category2 />' because I thought it’s superfluous due to the fact that I’ve assigned only a single category per article.

Last edited by woy (2009-04-13 23:18:26)

Offline

#17 2009-04-13 23:19:59

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

Re: problem with combined section/category/article navigation

woy wrote:

I had removed ,<txp:category2 />' because I thought it’s superfluous due to the fact that I’ve assigned only a single category per article.

OK, that’s fine, but did you change <txp:category /> to <txp:category1 />?

Offline

#18 2009-04-13 23:21:55

woy
Member
Registered: 2009-04-08
Posts: 18

Re: problem with combined section/category/article navigation

<txp:if_category>
<txp:article_custom category='<txp:category />' form="content_link" wraptag="ul" class="content_nav" />
</txp:if_category>
<txp:if_individual_article>
<txp:article_custom category='<txp:category1 />,<txp:category2 />' form="content_link" wraptag="ul" class="content_nav" />
</txp:if_individual_article>

That’s how my [content_nav] form looks right now.

Offline

#19 2009-04-13 23:24:48

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

Re: problem with combined section/category/article navigation

That’s really strange, because according to your tag trace it says this (inside the if_individual_article tags):

<txp:article_custom category='<txp:category />' form="content_link" wraptag="ul" class="content_nav" />

Offline

#20 2009-04-13 23:29:03

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

Re: problem with combined section/category/article navigation

I just looked at your page, and I think I get it now: you indeed must leave out the ,<txp:category2 />, because it appears to tell Txp to look in all categories if there is no category2. So what happens if you just have <txp:category1 /> there?

Last edited by els (2009-04-13 23:29:57)

Offline

#21 2009-04-13 23:34:12

woy
Member
Registered: 2009-04-08
Posts: 18

Re: problem with combined section/category/article navigation

Wow, that’s it. I can’t repeat to say thank you again, Els.

Could you please tell me what makes the difference between '<txp:category />' and '<txp:category />'

Offline

#22 2009-04-13 23:37:59

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

Re: problem with combined section/category/article navigation

Phew… I’m glad we found it :)

<txp:category /> looks for the category that is currently being viewed (= the category that is in the URL), so it only works on a category (list) page. <txp:category1 /> and <txp:category2 /> look at the category (1 or 2) that is assigned to the article currently viewed, so they only work on an individual article page.

Offline

#23 2009-04-13 23:42:27

woy
Member
Registered: 2009-04-08
Posts: 18

Re: problem with combined section/category/article navigation

Ah, good to know. Didn’t know that this makes such an significant difference.

Thanks and good night!

Offline

#24 2009-04-16 12:31:44

woy
Member
Registered: 2009-04-08
Posts: 18

Re: problem with combined section/category/article navigation

I’m sorry for reinvigorating this thread. After fixing this problem with Els’ help, I’m struggling with two related issues.

First one:

I’v marked my “news” section as “on front page” to display it when opening the website. My main navigation consist of a section list and I highlight the selected one using

<li<txp:if_section name='<txp:section/>'> class="active"<txp:else/> </txp:if_section>.

Is there a solution to declare the section “news” as selected although I’ve not navigated to it?

My second problem is linked to my the initial topic of this post:

Currently I put my articles in place using the following tag structure:

<txp:if_individual_article> <txp:article form="standard" /> <txp:else /> <txp:article status="sticky" form="standard" category='<txp:category>'/> </txp:if_individual_article> 

I’m using sticky articles as landing pages for the sections. These articles have also a category assigned and I would like to have my category highlighted when I navigate to a section.

Can I achieve this without hard coding the navigation in my templates?

Thanks in advance,

Sebastian

Offline

Board footer

Powered by FluxBB