Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-04-02 12:44:57

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

Confused with getting sub-col content

Hi guys, probably a really simple thing to do but wanted some advice/

I have created 1 page temple to be used on all 4 sections my site, the header graphics change using my css file by specifying <body id=”<txp:section />”>.
Each section has one main article as a ‘sticky’.

The page layout has a Secondary Column (sub-col).

My question is this, how would I be able to add links to other non-sticky articles into the secondary column (sub-col) that would change depending on what section the page is on?

Offline

#2 2009-04-02 14:33:39

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

Re: Confused with getting sub-col content

Do you mean links to other articles in the same section?

<txp:article_custom section='<txp:section />'>
   <txp:permlink><txp:title /></txp:permlink>
</txp:article_custom>

Offline

#3 2009-04-02 19:28:07

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

Re: Confused with getting sub-col content

Hi Els,

Because all my sections run off a single page could a Include a form like your above but with a
bc.. <txp:if_section name=“x”> <txp:article_custom section=’<txp:section />’> <txp:permlink><txp:title /></txp:permlink>
</txp:article_custom>
<txp:if_section name=“y”>
blah blah
<txp:if_section name=“z”>
blah blah
<txp:else/>
zzzzz
</txp:if_section>

Offline

#4 2009-04-02 21:35:24

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

Re: Confused with getting sub-col content

mrjysta wrote:

<txp:if_section name="x">
 <txp:article_custom section='<txp:section />'>
   <txp:permlink><txp:title /></txp:permlink>
</txp:article_custom>
<txp:if_section name="y"> 
blah blah
<txp:if_section name="z">
blah blah
<txp:else/>
zzzzz
</txp:if_section>

I’m not sure I understand what you want to do. I assumed that on section page ‘x’ you want to display a list of articles in section ‘x’, on section page ‘y’ a list of articles in section ‘y’, etcetera. That is what my example does. If you’d want to do that for some sections, but not all, you could do this:

<txp:if_section name="x,y,z">
	<txp:article_custom section='<txp:section />'>
		<txp:permlink><txp:title /></txp:permlink>
	</txp:article_custom>
<txp:else />
	do something else
</txp:if_section>

If you want to do something different for each section, your code isn’t entirely correct, it should look like this:

<txp:if_section name="x">
	do this
<txp:else />
	<txp:if_section name="y">
		do that
	<txp:else />
		<txp:if_section name="z">
			do yet another thing
		<txp:else />
			in all other cases, do something completely different
		</txp:if_section>
	</txp:if_section>
</txp:if_section>

Offline

#5 2009-04-02 23:08:24

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

Re: Confused with getting sub-col content

Thats exactly what I was trying to get working/ My if statements were totally out before.

Thanks Els!!!

Offline

#6 2009-04-09 17:31:26

aeris
Member
Registered: 2009-03-01
Posts: 12

Re: Confused with getting sub-col content

I came here to ask about displaying a category-sensitive article list on individual article pages (not article_related), but this worked =)

Still one problem though: back and forward links don’t work. Well, it’s probably because article_custom doesn’t get more than 8 articles, but is there a way to get it to work? This is what I have now:

if_category:

<txp:article limit=“8”>
<txp:permlink><txp:title /></txp:permlink>
</txp:article>
<txp:older showalways=“1”>prev</txp:older> <txp:newer showalways=“1”>next</txp:newer>

if_individual_article:

<txp:article_custom category=’<txp:category2 />’ limit=“8”>
<txp:permlink><txp:title /></txp:permlink>
</txp:article_custom>

Offline

#7 2009-04-09 21:03:49

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

Re: Confused with getting sub-col content

Pagination doesn’t work with article_custom. You can achieve the same BTW with <txp:related_articles match="Category2" /> (TextBook), but pagination won’t work with that either.
I’m pretty sure that pagination on an individual article page just isn’t possible…

Offline

#8 2009-04-10 00:03:33

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

Re: Confused with getting sub-col content

BTW guys after a bit more digging I found a great tutorial for this at the following link

Offline

Board footer

Powered by FluxBB