Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-10-01 13:30:33

spudz
Member
Registered: 2005-12-09
Posts: 28

Restricting Posts on Homepage

How can I only show one post on the homepage without restricting the amount of posts when in category view?

Offline

#2 2006-10-01 13:37:13

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,529
Website GitHub Twitter

Re: Restricting Posts on Homepage

are you want to view just one article in home page?

if it s that use the “limit” tag of txp:article or txp:article_custom

check the textbook for further details.

Offline

#3 2006-10-01 13:46:42

spudz
Member
Registered: 2005-12-09
Posts: 28

Re: Restricting Posts on Homepage

Dragondz wrote:

are you want to view just one article in home page?
if it s that use the “limit” tag of txp:article or txp:article_custom
check the textbook for further details.

Thats what I was doing, whenever I went into category view, (ie. http://www.example.com/category/Textpattern/) the post amount was limited to 1.

Any Ideas?

Offline

#4 2006-10-01 13:52:29

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,529
Website GitHub Twitter

Re: Restricting Posts on Homepage

Ok

then you can use a conditional tag or a plugin wich tests if you are at home page (it exists)

for the first solution :

< txp:if_section section=”“ >
< txp:article limit=“1” />
< txp:else />
< txp:article />
< /txp:if_section>

Look at textbook for tag details.

Last edited by Dragondz (2006-10-01 13:53:16)

Offline

#5 2006-10-01 14:20:56

spudz
Member
Registered: 2005-12-09
Posts: 28

Re: Restricting Posts on Homepage

Dragondz wrote:

Ok

then you can use a conditional tag or a plugin wich tests if you are at home page (it exists)

for the first solution :

< txp:if_section section=”“ >
< txp:article limit=“1” />
< txp:else />
< txp:article />
< /txp:if_section>

I checked textbook for tag details but I still could’nt get this working, I couldnt find that plugin either.

Still need some help with one.

Offline

#6 2006-10-01 14:28:23

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,529
Website GitHub Twitter

Re: Restricting Posts on Homepage

What do you mean by “could’n get working”, you haven t the desired result or get some error message?

the code i give you must be put in page template or form (remove spaces after <)!

Offline

#7 2006-10-01 14:40:16

spudz
Member
Registered: 2005-12-09
Posts: 28

Re: Restricting Posts on Homepage

Dragondz wrote:

What do you mean by “could’n get working”, you haven t the desired result or get some error message?

the code i give you must be put in page template or form (remove spaces after <)!

I got the same result as I had been getting before with the code you gave me, I had the code in the page and I removed the spaces but still no luck.

Cheers for your help so far.

Offline

#8 2006-10-01 14:55:17

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,529
Website GitHub Twitter

Re: Restricting Posts on Homepage

if you have just one section the code i gave you will not work!! and maybe ther is the pb!

maybe you can use if_category replacing if_section?

look here for tag details

Offline

#9 2006-10-01 15:00:14

spudz
Member
Registered: 2005-12-09
Posts: 28

Re: Restricting Posts on Homepage

Dragondz wrote:

if you have just one section the code i gave you will not work!! and maybe ther is the pb!

maybe you can use if_category replacing if_section?

look here for tag details

I’ve tried that too but to no avail, its a strange problem, it seems to put a limit on the excerpt no matter what I do.

Here is what I have at the moment.

< txp:if_category name=“Life, Textpattern, Web, Tutorials, Work”> < txp:article form=“excerpt” />
< txp:else /> < txp:article form=“excerpt” limit=“1” />
< /txp:if_category>

(without the space after the < )

Offline

#10 2006-10-01 15:13:26

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,529
Website GitHub Twitter

Re: Restricting Posts on Homepage

I don’t know where is the pb??

try making simple html texte in page in different part of the page to see what happens : like IF Categorye, Else, …

maybe find where is the pb??

Offline

#11 2006-10-01 17:58:06

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

Re: Restricting Posts on Homepage

spudz wrote:

I’ve tried that too but to no avail, its a strange problem, it seems to put a limit on the excerpt no matter what I do.

What if you explicitly give the first article tag a limit? It should work, because I’m using something similar on my site.

<txp:if_category>
<txp:article form="excerpt" limit="100" />
<txp:else />
<txp:article form="excerpt" limit="1" />
</txp:if_category>

(You can leave out the ‘name’ attribute if it goes for all categories.)

Offline

#12 2006-10-01 19:43:04

spudz
Member
Registered: 2005-12-09
Posts: 28

Re: Restricting Posts on Homepage

Els wrote:

spudz wrote:

I’ve tried that too but to no avail, its a strange problem, it seems to put a limit on the excerpt no matter what I do.

What if you explicitly give the first article tag a limit? It should work, because I’m using something similar on my site.

<txp:if_category>
<txp:article form="excerpt" limit="100" />
<txp:else />
<txp:article form="excerpt" limit="1" />
</txp:if_category>

(You can leave out the ‘name’ attribute if it goes for all categories.)

Hey Els, thanks for that bud, worked a charm.

Offline

Board footer

Powered by FluxBB