Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-04-14 22:39:53

Ruhh
Member
From: dakota dunes
Registered: 2008-01-20
Posts: 305

exclude article from listing

how do i exclude the article with the specified ID that is produced in the listing from a specified section?


<txp:Ruhh />

Offline

#2 2008-04-14 22:51:19

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

Re: exclude article from listing

You could make it a sticky article, but then you’d need a separate tag to display it elsewhere. Or do something like this in the article list form:

<txp:if_article_id id="123">
     <!-- do nothing -->
<txp:else />
     here your form code
</txp:if_article_id>

Offline

#3 2008-04-14 23:00:44

Ruhh
Member
From: dakota dunes
Registered: 2008-01-20
Posts: 305

Re: exclude article from listing

Actually, the specified article is a sticky article but the rest of the articles in the specified section are all sticky articles.

I tried that piece of code but it did not exclude the specified article from the listing.

Last edited by Ruhh (2008-04-14 23:02:24)


<txp:Ruhh />

Offline

#4 2008-04-14 23:00:58

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

Re: exclude article from listing

Not sure what you want to do but… sometimes I want to have an author-editable introduction to a section that should not be listed as an own article or in a submenu etc. Either I do it as a sticky article as Els suggests and call txp:article twice in that page template, first with txp:article form="mybriefintroform" status="sticky" limit="1" and then normally for the live articles (this is probably the better way to do it), or I will set the introduction article to hidden and then use txp:article_custom id="99" status="hidden" to display precisely that article where I want it.


TXP Builders – finely-crafted code, design and txp

Offline

#5 2008-04-14 23:07:34

Ruhh
Member
From: dakota dunes
Registered: 2008-01-20
Posts: 305

Re: exclude article from listing

Ok I will show you an example.

This is what I currently get:

About
  • Ask a Question
  • Online
  • Random Facts
  • Web History

I want to change the above to this:

About
  • Online
  • Random Facts
  • Web History

Again this is sectional archiving.

Last edited by Ruhh (2008-04-14 23:08:39)


<txp:Ruhh />

Offline

#6 2008-04-15 06:49:31

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

Re: exclude article from listing

Either way should work: txp:article and txp:article_custom will only list live articles unless the attribute status="..." is set. So, for example, for your archive page use txp:article_custom without the status attribute and on the page where the “Ask A Question” article should appear use status="sticky" (or hidden).

All the above is really only necessary if you want other site editors with less admin-area rights to be able to edit the text. If it doesn’t need editing or is too complex for most normal authors (e.g. a web input form), you can of course put the “Ask A Question” text (and query form) in a txp form and use txp:output_form form="ask-a-question" where you need it.


TXP Builders – finely-crafted code, design and txp

Offline

#7 2008-04-15 16:58:19

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

Re: exclude article from listing

Ruhh wrote:

I tried that piece of code but it did not exclude the specified article from the listing.

1. What does your article tag (to display the listing) look like?
2. What does your article form (specified as listform in the article tag) look like?

Offline

#8 2008-04-15 22:40:32

Ruhh
Member
From: dakota dunes
Registered: 2008-01-20
Posts: 305

Re: exclude article from listing

article_custom tag used in page template:

<txp:article_custom limit=99999 form=“sitemap” section=“about” status=“sticky” />
<br />
<txp:article_custom limit=99999 form=“sitemap” section=“site” status=“sticky” />

article form:

<!— show the section —>
<txp:if_different>
<txp:section title=“1” />
<br />
</txp:if_different>
<!— article title and link —>
<txp:permlink><txp:title /></txp:permlink>
<br />

so what i want is to exclude an article with the specified id from the listing…

Last edited by Ruhh (2008-04-15 22:53:29)


<txp:Ruhh />

Offline

#9 2008-04-15 23:06:10

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

Re: exclude article from listing

This should work:

<!-- show the section -->
<txp:if_different>
<txp:section title="1" />
<br />
</txp:if_different>
<!-- article title and link -->
<txp:if_article_id id="123">
<txp:else />
<txp:permlink><txp:title /></txp:permlink>
</txp:if_article_id>
<br />

(where article id 123 is the one you want to exclude of course)

Offline

#10 2008-04-15 23:13:55

Ruhh
Member
From: dakota dunes
Registered: 2008-01-20
Posts: 305

Re: exclude article from listing

thanks, that worked! but why is there a blank line in replace of excluded article?

edit: nevermind :) i got it. just had to move the br tag next to the ending permlink tag.

Last edited by Ruhh (2008-04-15 23:19:13)


<txp:Ruhh />

Offline

#11 2008-04-15 23:42:52

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

Re: exclude article from listing

Oh sorry, I overlooked the <br />… of course it should be inside the conditional.

Offline

Board footer

Powered by FluxBB