Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2007-12-29 17:35:27
- Sono Juventino
- Member
- From: Skedsmo, Norway
- Registered: 2007-12-22
- Posts: 81
Display read more only when there's more to read. (Fixed)
I’ve got two small questions:
1. Is there any chance of hiding the “read more”-heading below when there is nothing more to read? <h4 class=“more”> should only be displayed when there is something written in body. (Note that I’m using excerpt as an “teaser”.)
This is my actions under all news.
<div class="actions" id="actions_full">
<h4 class="category"><span class="hidden">Category:</span></h4><p>Category here</p>
<h4 class="more"><txp:permlink><span class="hidden">Les Videre</span></txp:permlink></h4>
</div>
2. How do I display which category the news are posted in?
Last edited by Sono Juventino (2008-01-04 16:34:27)
Offline
Re: Display read more only when there's more to read. (Fixed)
Case number one could be done with a little PHP-magic:
<txp:php>
$readmore = '<h4 class="more"><a href="'.permlink().'"><span class="hidden">Les Videre</span></a></h4>';
echo ($GLOBALS['thisarticle']['body']) ? $readmore : '';
</txp:php>
2. txp:category1 and txp:category2
Cheers!
Offline
Re: Display read more only when there's more to read. (Fixed)
chh_if_data can also do this.
Code:
<txp:if_individual_article>Posted by <txp:author />, <txp:posted /><txp:chh_if_data><br />
Filed under: <txp:category1 title="1" link="1" /></txp:chh_if_data><txp:chh_if_data>, <txp:category2 title="1" link="1" /></txp:chh_if_data></txp:if_individual_article>
The above is from Reid’s Web Writer template.
Offline
Re: Display read more only when there's more to read. (Fixed)
jstubbs, then we would need the body tag and we don’t want it to the page ;) Thought we could comment it out but…
Well it works those categories, as we can’t know if both are used. In example the dot, or break-tag between them could be outputted ;)
Cheers!
Last edited by Gocom (2007-12-29 18:10:49)
Offline
Re: Display read more only when there's more to read. (Fixed)
About 1, I hope this helps:
Offline
#6 2007-12-30 14:57:12
- Sono Juventino
- Member
- From: Skedsmo, Norway
- Registered: 2007-12-22
- Posts: 81
Re: Display read more only when there's more to read. (Fixed)
Oh. Looks like I pushed you away a little to sonn, maniqui:
The “if_excerpt” could be very usefull. Hope it works to do “if_body” instead. I’ll try that.
Btw, Gocom. Your php-method dosen’t work. Maybe i’ll have to put it on my default page, but it dosen’t worked out in forms.
Offline
Re: Display read more only when there's more to read. (Fixed)
Sono Juventino,
No, it works. You’re probably missusing it, as it should be used inside article forms – as should those other tags as you provided. So, it works as it should be.
And no, there isn’t any txp:if_body
-tag.
Cheers!
Last edited by Gocom (2007-12-30 16:34:37)
Offline
#8 2007-12-30 16:44:18
- Sono Juventino
- Member
- From: Skedsmo, Norway
- Registered: 2007-12-22
- Posts: 81
Re: Display read more only when there's more to read. (Fixed)
Strange, Gocom. I’ll try again later.
Thanks everyone.
Offline
#9 2008-01-04 16:34:11
- Sono Juventino
- Member
- From: Skedsmo, Norway
- Registered: 2007-12-22
- Posts: 81
Re: Display read more only when there's more to read. (Fixed)
Looks like this worked out. Thank you very much everybody!
Offline