Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-09-04 08:33:17

gavnosis
Member
From: Milton Keynes, UK
Registered: 2005-03-12
Posts: 151
Website

[SOLVED] List of articles in current section when individual article

I have no problem displaying a list of articles in the current section of my site

<txp:article form="titles" />

with’ titles’ form something like this

<txp:permlink><txp:title /></txp:permlink>

This produces a beautiful list of all the articles in the current section Q.E.D. However, when following a link through to an individual article the list of articles is reduced to just the current article (This is for a site arranged as section/title)

I know I can use <txp:article_custom /> but that doesn’t leave me with a dynamic solution which can be applied to more than one section i.e. this is an illegal move:

<txp:article_custom form="titles" section=" <txp:section />" />

Surely this is possible? Thanks

Offline

#2 2011-09-04 08:41:09

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,258
Website GitHub Mastodon Twitter

Re: [SOLVED] List of articles in current section when individual article

Hi

Try

<txp:article_custom form="titles" section='<txp:section />' limit="20" />

Note the single quotes.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2011-09-04 08:45:17

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,258
Website GitHub Mastodon Twitter

Re: [SOLVED] List of articles in current section when individual article

Also, if you want the current article to be omitted, thanks to Jukka, there is a solution

<txp:article_custom section='<txp:section />' limit="20">
<txp:if_article_id id='<txp:article_id />'>
<txp:else />
<txp:permlink><txp:title /></txp:permlink>
</txp:if_article_id>
</txp:article_custom>

Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#4 2011-09-04 08:45:28

gavnosis
Member
From: Milton Keynes, UK
Registered: 2005-03-12
Posts: 151
Website

Re: [SOLVED] List of articles in current section when individual article

Ah, the old ‘single quotes’ trap! Thank you Colak, I thought I was losing my mind… :-) Works a treat!

Offline

#5 2011-09-04 08:55:35

gavnosis
Member
From: Milton Keynes, UK
Registered: 2005-03-12
Posts: 151
Website

Re: [SOLVED] List of articles in current section when individual article

…although Colak, I can’t seem to get Jukka’s ‘icing on the cake’ to work. I just replace the call to my custom form with this chunk of code in a page?

Offline

#6 2011-09-04 09:24:11

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,258
Website GitHub Mastodon Twitter

Re: [SOLVED] List of articles in current section when individual article

Hi:) Replace your ‘titles’ form content with

<txp:if_article_id>
<txp:else />
<txp:permlink><txp:title /></txp:permlink>
</txp:if_article_id>

Edit: correction id='<txp:article_id />' is not needed.

Last edited by colak (2011-09-04 09:30:57)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#7 2011-09-04 09:48:40

gavnosis
Member
From: Milton Keynes, UK
Registered: 2005-03-12
Posts: 151
Website

Re: [SOLVED] List of articles in current section when individual article

Sorry, Colak, but that doesn’t work for me… The individual case works fine, and shows all articles except the current (QED), but the section page shows no list at all…

Last edited by gavnosis (2011-09-04 10:10:51)

Offline

#8 2011-09-04 11:44:07

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,258
Website GitHub Mastodon Twitter

Re: [SOLVED] List of articles in current section when individual article

This might work

<txp:if_individual_article> <!-- Check if you are in an individual article page -->
<txp:if_article_id> 
<!-- When in an individual article page check if the article id is in the list and exclude it -->
<txp:else />
<txp:permlink><txp:title /></txp:permlink> <!-- show linked titles -->
</txp:if_article_id>
<txp:else /> <!-- check if you are in an article list -->
<txp:permlink><txp:title /></txp:permlink> <!-- show linked titles -->
</txp:if_individual_article>

Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB