Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-02-07 10:13:55

thoresson
New Member
From: Sweden
Registered: 2005-02-02
Posts: 6

select articles to go on the frontpage

Hi,

For the frontpage of a new site I’m about to build, I need not the x latest articles, but rather:

- two latest articles from section “Interviews”
- most read article from section “Interviews”
- one random article, not being one of the three above, from section “Interviews”
- five latest articles from section “Blog”

Is this possible – with the standard tags or an existing plugin? Or do I need to write a plugin of my own?

/Anders

Offline

#2 2006-02-07 11:35:52

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

Re: select articles to go on the frontpage

For your latest articles use something like <code><txp:article_custom section=“interviews” limit=“2” /></code> and similar for your “blog” section. Most popular article would require a plug-in. There was one available but it only displayed a list of titles and I’m not sure if it still works. It might give you some ideas on how to code one yourself though.

Most difficult I think would be the random article because, by specifying it musn’t contain the other 3, it is no longer truely random.


Stuart

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

Offline

#3 2006-02-10 13:05:09

thoresson
New Member
From: Sweden
Registered: 2005-02-02
Posts: 6

Re: select articles to go on the frontpage

Is it possible to use rand() and only have it randomize from a certain category? Or better yet, to exclude a certain category? If so, I could always make sure that the latest two, and only the latest two, articles is in the category “latest” and then exclude that gategory when making the random choice.

If not possible, would it work if all but the latest two were in the category “archive” and randomize from that?

All above without my third wish, to have the most read on the frontpage, of course. I have understood that my original wish only comes true if I make my own plugin, and I don’t have time for that right now.

/Anders

Offline

#4 2006-02-10 17:58:42

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

Re: select articles to go on the frontpage

thoresson wrote:

Is it possible to use rand() and only have it randomize from a certain category? Or better yet, to exclude a certain category? If so, I could always make sure that the latest two, and only the latest two, articles is in the category “latest” and then exclude that gategory when making the random choice.

If you have for example 5 categories and you wanted to exclude category4:
<code>
<txp:article_custom section=“interviews” category=“category1,category2,category3,category5” limit=“1” sortby=“rand()” />
</code>

If not possible, would it work if all but the latest two were in the category “archive” and randomize from that?

<code><txp:article_custom section=“interviews” category=“archive” limit=“1” sortby=“rand()” />
</code>
So it would depend on how many categories you have which way is easier.

Offline

Board footer

Powered by FluxBB