Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-11-29 05:32:31

jmart
Member
Registered: 2008-08-25
Posts: 68

How to hide specific article link on the sidebar

I have a list of articles for a specific section that is automatically generated on the sidebar. The code looks like this;

<txp:if_section name="about">
       <h2 class="sidebarbox"><txp:section title="1" /></h2>
       <ul id="sidebarbox"><txp:article_custom section="about" form="subpagelist" sort="Title asc" />
       </ul>
     </txp:if_section>

How would I go about omitting a specific article so that it doesn’t get generated? Perhaps I have to avoid using the article_custom tag since it doesn’t have an attribute that allows me to omit an article

Offline

#2 2008-11-29 07:27:20

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

Re: How to hide specific article link on the sidebar

One way is to give the article another status and with the article_custom status="live" attribute to limit it only to output live articles.
Another way is to use txp:if_article_id in your form to show nothing for the article with that ID number, else display usual form content.


TXP Builders – finely-crafted code, design and txp

Offline

#3 2008-11-30 07:07:12

jmart
Member
Registered: 2008-08-25
Posts: 68

Re: How to hide specific article link on the sidebar

The first won’t do it for me (and I did consider that option along with giving a custom_field option as well). The problem is that while I don’t want the link to be automatically generated in the sidebar, I still want that page to appear for that section. Basically, that particular page is the landing page for that section when a user visits that section. So making it hidden won’t do me any good as the user won’t see anything when they visit that section.

I’m not sure if I understand how the if_article_id tag will work as I just don’t want the link to appear in the sidebar

Offline

#4 2008-11-30 17:21:20

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

Re: How to hide specific article link on the sidebar

jmart wrote:

So making it hidden won’t do me any good as the user won’t see anything when they visit that section.

I think Jakob was referring to status ‘sticky’ rather than ‘hidden’. <txp:article /> and <txp:article_custom /> display only live articles by default. Your article_custom tag in the sidebar therefore won’t show the sticky article. You’d have to add status="sticky" to the article tag for the landing page to show it there.

I’m not sure if I understand how the if_article_id tag will work as I just don’t want the link to appear in the sidebar

In your article form ‘subpagelist’:

<txp:if_article_id id="123">
   // nothing here, so nothing will be displayed for article '123'
<txp:else />
   // your form content here
</txp:if_article_id>

Offline

Board footer

Powered by FluxBB