Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-10-31 07:33:27

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Using conditional tags to provide default behaviours. (if_excerpt)

This tag arrangement will return the article excerpt if one exists, or the article section if no excerpt exists.

<txp:if_excerpt>
<txp:excerpt />
<txp:else />
Section <a href="/index.php?s=<txp:section />"><txp:section /></a> 
</txp:if_excerpt>

<txp:section link="1" /> will return the section name, linked, as well.

It keeps that excerpt lead from dangling when you don’t have an excerpt assigned to an article.

Offline

#2 2005-11-01 03:55:03

squaredeye
Member
From: Greenville, SC
Registered: 2005-07-31
Posts: 1,495
Website

Re: Using conditional tags to provide default behaviours. (if_excerpt)

I have been looking for a way to output the section of an article in search results for awhile now.
Thanks. This is perfect.

I use it in conjuction with zem’s article image plugin

I use it like this:

<h3 class="content-title">
<txp:permlink><txp:title /></txp:permlink>
</h3>
<br/>
<div class="thumb">
<txp:permlink><txp:zem_article_thumb /></txp:permlink>
</div><!--close thumb-->
<p>
Section <strong><a href="/index.php?s=<txp:section />"><txp:section /></a></strong>
<small>
<txp:posted />
</small>
</p>

Or if you prefer to use your “reader friendly” section name by using the plugin <txp:upm_section_title /> found here

Last edited by ma_smith (2005-11-01 13:11:55)


Offline

Board footer

Powered by FluxBB