Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-12-09 12:13:06

Kosmo
Member
Registered: 2005-10-06
Posts: 22

Using posts as news items

I’m using TXP as a CMS for my site and I’d like to know how I can use the posts as news items and more importantly display them as links like one would display them if they were news.

Here is an example what I’m after.
First there should be the most recent post like so:

09.12.05 | This just in, Kosmo posts to TXP forums, this is actually the title and excerpt of the actual post.

And then there should be an archive of the 5 last posts, starting from the second ofcourse since first is already posted above:

08.12.05 | Just a title of the post
03.12.05 | Another post
22.11.05 | I guess you got the point

So how do I create links to my posts like this?

Offline

#2 2005-12-09 12:35:56

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Using posts as news items

You need to create a new article form with just the date and permlinked title in it then add a secont article tag under your first using something like <code><txp:article limit=“5” offset=“1” form=“newFormName” /></code>


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#3 2005-12-09 13:02:36

Kosmo
Member
Registered: 2005-10-06
Posts: 22

Re: Using posts as news items

Sounds easy enough. But how do I do the first one?

Oh and I need to only display articles written for section “news.” Or should I create category for them so I could call them by category?

Last edited by Kosmo (2005-12-09 13:14:21)

Offline

#4 2005-12-09 14:02:21

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Using posts as news items

Sounds easy enough. But how do I do the first one?

Create yet another article form. You might call it “top_story”. It might look like this:

<h2><txp:posted /> | <txp:title /></h2>
<p><txp:excerpt /></p>

Then fetch the newest article with:

<txp:article limit="1" form="top_story" />

Oh and I need to only display articles written for section “news.” Or should I create category for them so I could call them by category?

One way to do this is in presentation > sections, set all sections other than “news” to not appear on the front page. Depending on how you have your search results page set up, this could require additional tinkering (not sure about this).

Last edited by jsoo (2005-12-09 14:05:04)


Code is topiary

Offline

#5 2005-12-09 14:05:38

Kosmo
Member
Registered: 2005-10-06
Posts: 22

Re: Using posts as news items

The problem is that the news section isn’t the first page, the first page is an introductory page and the news article and news archive are under page navigation on a sidebar of sorts. Can’t I just give some sort of option to the article tag to present a section or category. I didn’t find option for this on the textbook but surely there is a way.

Offline

#6 2005-12-09 14:08:11

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Using posts as news items

Try it with <txp:article_custom />. That allows you to specify the section.


Code is topiary

Offline

Board footer

Powered by FluxBB