Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-01-04 03:17:09

carrotrope
Member
From: Edinburgh
Registered: 2007-03-16
Posts: 39

Display most recent/second/third title in specific section

Hi all,

For a website I’m currently building I’ve got a news page and a scrolling ticker on the front page. The ticker scrolls through 3 separate bits of text – is there a tag or other method of making Textpattern output the title of the most recent article, the second most recent article, and the third most recent..?

Thanks in advance,
Jez

Offline

#2 2008-01-04 03:39:03

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

Re: Display most recent/second/third title in specific section

the textbook is your friend -> <txp:recent_articles />

you could also use <txp:article_custom /> if you need to more customization to how you want to output the display of your recent article list

Last edited by iblastoff (2008-01-04 03:48:36)

Offline

#3 2008-01-08 02:50:52

carrotrope
Member
From: Edinburgh
Registered: 2007-03-16
Posts: 39

Re: Display most recent/second/third title in specific section

Hi iblastoff,

Thanks! I knew it would be in Textbook somewhere, but I had no idea what to search for.

My problem however is I need separate tags to output the most recent title in one place, the second most recent in another, the third somewhere else etc.. is there something like an ‘offset’ value for <txp:recent_articles />?

Any help appreciated,
Jez

Last edited by carrotrope (2008-01-08 03:01:31)

Offline

#4 2008-01-08 03:06:06

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Display most recent/second/third title in specific section

Look at the second link Steve posted.

Offline

#5 2008-01-08 17:28:58

carrotrope
Member
From: Edinburgh
Registered: 2007-03-16
Posts: 39

Re: Display most recent/second/third title in specific section

Hi Mary,

I’ve attempted it, but can’t seem to achieve what I want. This is what I have so far (including the javascript I’m using for the ticker):

var news=new Array()
news0=’<txp:article_custom form=“newsticker” section=“news” limit=“1” />’
news1=’<txp:article_custom form=“newsticker” section=“news” limit=“1,1” />’
news2=’<txp:article_custom form=“newsticker” section=“news” limit=“2,1” />’

From reading this (http://thresholdstate.com/articles/3649/customizing-txprecentarticles) page, I thought this would give me:

1. the most recent article in the ‘news’ section
2. one article from the ‘news’ section, starting with the second
3. one article from the ‘news’ section, starting with the third

As you see, I can’t output a list of the articles, as the javascript requires them to be split up. Is it possible to achieve this?

Thanks in advance!
Jez

Offline

#6 2008-01-08 17:36:41

carrotrope
Member
From: Edinburgh
Registered: 2007-03-16
Posts: 39

Re: Display most recent/second/third title in specific section

Ah-ha! Found it. I didn’t see that <txp:article_custom /> has an ‘offset’ attribute – just what I needed! The minutiae of what Textpattern can achieve continually amazes me. Great stuff. Thanks for your help guys!

Offline

Board footer

Powered by FluxBB