Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-06-09 10:02:45

Dandruff
Member
Registered: 2007-03-16
Posts: 18

Split an article list into 3 unordered lists

Hi there.

I need article lists with anchor links, so I’m using <txp:article_custom/> to display it.
I want three lists of ten articles to appear so I wrote this:

<ul><txp:article_custom form="listing" limit="10"  /></ul>
<ul><txp:article_custom form="listing" limit="10" offset="10" /></ul>
<ul><txp:article_custom form="listing" limit="10" offset="20" /></ul>

The “listing” form looks like this:

<li><a href="#<txp:php>echo $GLOBALS['thisarticle']['url_title'];</txp:php>"><txp:title /></a></li>

Everything’s works fine, except that when there’s less than 30 articles, of course the empty <ul></ul> tags make the XHTML validation fail, and it’s an issue for this website.

Since I can’t use something like wraptag=“ul” on a <txp:article_custom/> tag, do someone have an idea?
thanks in advance.

Last edited by Dandruff (2007-06-09 10:03:23)

Offline

#2 2007-06-09 12:09:02

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

Re: Split an article list into 3 unordered lists

You can use plugin chh_if_data, install it and use it like this

<txp:chh_if_data>
<ul><txp:article_custom form=“listing” limit=“10” offset=“20” /></ul>
</txp:chh_if_data>

Th eplugin is here

A+

Offline

#3 2007-06-09 12:11:42

Dandruff
Member
Registered: 2007-03-16
Posts: 18

Re: Split an article list into 3 unordered lists

wow thanks I’m gonna try this

Offline

#4 2007-06-11 03:19:09

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

Re: Split an article list into 3 unordered lists

You can do this without a plugin. Make use of if_first_article and if_last_article in your article form to wrap around your opening and closing list tags (respectively).

Offline

#5 2007-06-11 07:05:18

Dandruff
Member
Registered: 2007-03-16
Posts: 18

Re: Split an article list into 3 unordered lists

Even better. I was thinking these tags wouldn’t work since I split the list, but they do!
Thanks for the help.

——
btw Mary, upm_image is like my favorite plugin ever ;)

Offline

Board footer

Powered by FluxBB