Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2007-09-03 20:49:16

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Categories: Showing specfic category excerpt list on separate page

You can ignore the message. If you really don’t like it, add <txp:php>global $has_article_tag; $has_article_tag = true;</txp:php> to your page template ;)

Offline

#14 2007-09-04 06:18:51

Timid&friendly
Member
From: The Netherlands
Registered: 2006-05-28
Posts: 252
Website

Re: Categories: Showing specfic category excerpt list on separate page

Thanks man, it’s good to know. I hate having loose ends :-D


I think, therefore I AM, … … er … I think :-?

Offline

#15 2007-09-14 09:06:44

Timid&friendly
Member
From: The Netherlands
Registered: 2006-05-28
Posts: 252
Website

Re: Categories: Showing specfic category excerpt list on separate page

Sorry to bother u guys again. I thought i understood everyones comments but alas still needs some guidance…

when i click a category the link take you to category section (hooray).
My problem is that i can’t get it to generate the correct category articles.

The code beneath produces All categories

<txp:if_individual_article>
	<txp:article limit="1" form="MTS_single" />
 	<p><txp:link_to_prev><txp:prev_title /></txp:link_to_prev> 
		<txp:link_to_next><txp:next_title /></txp:link_to_next></p>
<txp:else />
	<txp:if_category>
		<h3>Articles in category <txp:category title="1" />:</h3>
		<txp:article_custom sort="LastMod desc" limit="3" form="MTS_article_default" />
	</txp:if_category>
<p><txp:older><txp:text item="older" /></txp:older> 
		<txp:newer><txp:text item="newer" /></txp:newer></p>
</txp:if_individual_article>

But this code underneath only shows the articles for the first category.

<txp:if_individual_article>
	<txp:article limit="1" form="MTS_single" />
 	<p><txp:link_to_prev><txp:prev_title /></txp:link_to_prev> 
		<txp:link_to_next><txp:next_title /></txp:link_to_next></p>
<txp:else />
	<txp:if_category name="Acties">
		<h3>Articles in category <txp:category title="1" />:</h3>
		<txp:article_custom category="Acties" sort="LastMod desc" limit="3" form="MTS_article_default" />
	</txp:if_category>
<txp:else />
        <txp:if_category name="Pleegmoeder-schrijft">
		<h3>Articles in category <txp:category title="1" />:</h3>
		<txp:article_custom category="Pleegmoeder-schrijft" sort="LastMod desc" limit="3" form="MTS_article_default" />
	</txp:if_category>
<txp:else />
        <txp:if_category name="Van-de-Playground">
		<h3>Articles in category <txp:category title="1" />:</h3>
		<txp:article_custom category="Van-de-Playground" sort="LastMod desc" limit="3" form="MTS_article_default" />
	</txp:if_category>
<txp:else />
        <txp:if_category name="Van-de-Psycholoog">
		<h3>Articles in category <txp:category title="1" />:</h3>
		<txp:article_custom category="Van-de-Psycholoog" sort="LastMod desc" limit="3" form="MTS_article_default" />
	</txp:if_category>
	<p><txp:older><txp:text item="older" /></txp:older> 
		<txp:newer><txp:text item="newer" /></txp:newer></p>
</txp:if_individual_article>

It doesn’t matter which category i place as first, but only the first is shown. Why are the other categories not being shown when clicked upon?

Last edited by Timid&friendly (2007-09-14 09:12:16)


I think, therefore I AM, … … er … I think :-?

Offline

#16 2007-09-14 11:20:18

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Categories: Showing specfic category excerpt list on separate page

Because wrongly used <txp:else />-tags. So, remove all other <txp:else />-tags, but leave the first one.

Cheers!

Offline

#17 2007-09-14 12:31:17

Timid&friendly
Member
From: The Netherlands
Registered: 2006-05-28
Posts: 252
Website

Re: Categories: Showing specfic category excerpt list on separate page

Gocom, Thx. I was so sure i’d tried that DOH!!! Finally works. A big thx.

One more question.
As you see, I am currently manually adding the extra category name attribute to directly target a specific category.

The problem is of course this means if an additional category is added that I have then go back and manually add that category to the <txp:if_category name="x"> list. Not very efficient! I sure you’d agree :-/

I noticed that clever-clog Mary the developer had a solution that nearly worked for me in this thread that produced the correct articles but without having to manually code each individual category. Is there a way to achieve this on the category section-template. My attempts haven’t worked.

Mary’s code:-

<txp:if_individual_article>
	<txp:article limit="1" form="MTS_single" />
	    <p><txp:link_to_prev><txp:prev_title /></txp:link_to_prev> 
		<txp:link_to_next><txp:next_title /></txp:link_to_next></p>
<txp:else />
	<txp:if_category>
		<h3>Articles in category <txp:category title="1" />:</h3>
		<txp:article limit="5" />
	<txp:else />
		<h3>All articles:</h3>
		<txp:article_custom category="diverse" sort="LastMod desc" limit="3" form="MTS_article_default" />
	</txp:if_category>
	<p><txp:older><txp:text item="older" /></txp:older> 
		<txp:newer><txp:text item="newer" /></txp:newer></p>
</txp:if_individual_article>

I think, therefore I AM, … … er … I think :-?

Offline

#18 2007-09-14 13:12:35

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Categories: Showing specfic category excerpt list on separate page

Well, you don’t need that <txp:if_category name="x">, because default <txp:article />-tag is a category sensitive.

<txp:if_category>
	<txp:if_article_list>
		<h3>Articles in category <txp:category title="1" />:</h3>
		<txp:article sort="LastMod desc" limit="3" form="MTS_article_default" />
	</txp:if_article_list>
</txp:if_category>
<txp:if_individual_article>
	<txp:article limit="1" form="MTS_single" />
 	<p><txp:link_to_prev><txp:prev_title /></txp:link_to_prev> <txp:link_to_next><txp:next_title /></txp:link_to_next></p>
</txp:if_individual_article>
<txp:if_article_list>
	<p><txp:older><txp:text item="older" /></txp:older> <txp:newer><txp:text item="newer" /></txp:newer></p>
</txp:if_article_list>

Cheers!

Last edited by Gocom (2007-09-14 13:16:12)

Offline

#19 2007-09-14 14:15:28

Timid&friendly
Member
From: The Netherlands
Registered: 2006-05-28
Posts: 252
Website

Re: Categories: Showing specfic category excerpt list on separate page

Cheers back at ya Gocom. Really thx man!

But I guess it only works on the default page right!

The code you suggested is similar to my own attempt (well … the result is the same):-

<txp:if_individual_article>
	<txp:article limit="1" form="MTS_single" />
	<p><txp:link_to_prev><txp:prev_title /></txp:link_to_prev> 
		<txp:link_to_next><txp:next_title /></txp:link_to_next></p>
<txp:else />
	<txp:if_category>
		<h3>Articles in category <txp:category title="1" />:</h3>
		<txp:article sort="LastMod desc" limit="3" form="MTS_article_default" />
	</txp:if_category>
	<p><txp:older><txp:text item="older" /></txp:older> 
		<txp:newer><txp:text item="newer" /></txp:newer></p>
</txp:if_individual_article>

Which only outputs the category title <txp:category title="1" /> and not the actual article itself?

Am i correct in thinking that the <txp:article /> is also section sensitive.
All the articles are assigned (by default) to the “article” section which is of course owned by the default page-template. (i’m having to use a different section because i want a different layout, and specifically a section I named “category”).

Could this be the reason It’s not outputing the articles.

Last edited by Timid&friendly (2007-09-14 14:17:10)


I think, therefore I AM, … … er … I think :-?

Offline

#20 2007-09-14 18:03:35

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

Re: Categories: Showing specfic category excerpt list on separate page

Timid&friendly wrote:

Am i correct in thinking that the <txp:article /> is also section sensitive.

Yep :) It knows on which section or category page you are, if you’re in an article list or on an individual article’s page (so you also don’t need the limit="1" in that first article tag).

In this case you need article_custom again. Together with asy_wondertag you can use it like this:

<txp:asy_wondertag><txp:article_custom category="<txp:category />" sort="LastMod desc" limit="3" form="MTS_article_default" /></txp:asy_wondertag>

Offline

#21 2007-09-14 19:39:40

Timid&friendly
Member
From: The Netherlands
Registered: 2006-05-28
Posts: 252
Website

Re: Categories: Showing specfic category excerpt list on separate page

Heee Els WonderWoman lol, Bedankt.

That did the job. It took a long time getting there but in the process I have learned so much. Many thanks to you all.


I think, therefore I AM, … … er … I think :-?

Offline

Board footer

Powered by FluxBB