Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-04-24 15:18:05

macriis
New Member
Registered: 2007-10-08
Posts: 6

List articles from section in submenu but not one specific article

Hi,

I have a section with multiple articles. On the front page of the section I show a primary description article for that section with the tag:

<txp:article form="mainpages" limit="1" sort="Posted asc" />

Then I have a submenu showing all articles in the section, but I’ll like to omit the article for the front page of that section. I use this tag to show the article list:

<txp:recent_articles section="profile" break="<br /><br />" label="" />

I’ve tried this solution (http://textpattern.com/faq/84/how-do-i-keep-a-post-at-the-top-of-the-page) but it doesn’t help when all articles uses the same section, e.g. domain.com/profile. Then only the “sticky” articles are shown or the other way around.

I think it’s an simple question, but I havn’t been able to solve by reading the FAQ.

Offline

#2 2008-04-24 15:42:23

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,727
Website

Re: List articles from section in submenu but not one specific article

I think the sticky article as intro variant should work for you if use

<txp:article form="mainpages" limit="1" status="sticky" />

followed by

<ul><txp:article form="my_submenu_form" sort="Posted asc" /></ul>

in your txp:if_article_list conditional section of your page template. The form my_submenu_form could look something like this:

<li><txp:permlink><txp:title /></txp:permlink></li>

txp:article usually only lists live articles so the second iteration will automatically leave out the sticky articles.

Last edited by jakob (2008-04-24 15:43:17)


TXP Builders – finely-crafted code, design and txp

Offline

#3 2008-04-24 18:09:35

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: List articles from section in submenu but not one specific article

macriis wrote:

but I’ll like to omit the article for the front page of that section. I use this tag to show the article list:

<txp:recent_articles section="profile" break="<br /><br />" label="" />

If I understood correctly you need to add the attribute offset=“1” like so:

<txp:recent_articles section="profile" break="<br /><br />" label="" offset="1"  />

Offline

#4 2008-05-28 08:31:45

macriis
New Member
Registered: 2007-10-08
Posts: 6

Re: List articles from section in submenu but not one specific article

redbot wrote:

If I understood correctly you need to add the attribute offset=“1” like so:

<txp:recent_articles section="profile" break="<br /><br />" label="" offset="1"  />

This doesn’t work. I get the error shown beneath:

tag_error <txp:recent_articles section="beboere" break="<br /><br />" label="" offset="1" /> ->  Textpattern Notice: Unknown tag attribute: offset  on line 605

Offline

#5 2008-05-28 09:03:39

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: List articles from section in submenu but not one specific article

Yes, my suggestion was intended for use with the <txp:article /> tag instead of recent_articles.
Try something like this:

<txp:article form="my_submenu_form" offset="1" />

Offline

#6 2008-05-28 09:07:58

macriis
New Member
Registered: 2007-10-08
Posts: 6

Re: List articles from section in submenu but not one specific article

jakob wrote:

I think the sticky article as intro variant should work for you if use

<txp:article form="mainpages" limit="1" status="sticky" />

followed by

<ul><txp:article form="my_submenu_form" sort="Posted asc" /></ul>

in your txp:if_article_list conditional section of your page template. The form my_submenu_form could look something like this:

<li><txp:permlink><txp:title /></txp:permlink></li>

txp:article usually only lists live articles so the second iteration will automatically leave out the sticky articles.

Hi Jakob,

I think that I’ve explained myself wrong. I’ve tried something like your suggestion but it doesn’t work for me. I’ll try explain it again:
  • The section Profile has e.g. 3 articles. One of the articles must be shown when the sections is browsed (www.strandhjem.dk/profil). The article that must be shown on the front page is always the article with the oldest posted date. Therefore I use the limit="1" sort="Posted asc" attributes in the article-tag.
  • The submenu should then show the rest of the articles e.g. articles newer than the aforementioned article.
  • As you see the site is online now. Take a look at the real thing.

When I tried to set the article for the front page of the section with status Sticky and the rest of the articles with status Live i experienced that it looks okay when the section is browsed at first. But when I click the article links in the submenu the articles aren’t shown. This must be because this tag: <txp:article form="mainpages" limit="1" status="sticky" /> . Is there a way to let this tag show both Sticky and Live articles?

The section uses the same form to show the individual articles and I guess this is why I have had problems to show both live and sticky articles.

Offline

#7 2008-05-28 09:50:53

macriis
New Member
Registered: 2007-10-08
Posts: 6

Re: List articles from section in submenu but not one specific article

redbot wrote:

Yes, my suggestion was intended for use with the <txp:article /> tag instead of recent_articles.
Try something like this:

<txp:article form="my_submenu_form" offset="1" />

Hi both of you

Problem solved. redbots suggestion did the job. I just had to use the <txp:article_custom /> instead of <txp:article />. If i didn’t use the <txp:article_custom /> all articles wouldn’t show when a individual article is shown. The resulting tag is:

<ul><txp:article_custom form="sidebar_link_artikler" section="profil" sort="Posted asc" offset="1" /></ul>

Thank you for your help.

Offline

Board footer

Powered by FluxBB