Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#13 2009-03-26 23:17:20
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: How to highlight article title ... !?
Does that mean it’s working correctly now?
Offline
Re: How to highlight article title ... !?
Yes … :)
:%) = blushing
Many thanks Els!
Offline
#15 2009-03-26 23:26:46
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: How to highlight article title ... !?
Are you thanking me for all this confusion caused by me posting erroneous code? You really shouldn’t… ;)
(edit: typo)
Last edited by els (2009-03-27 01:51:40)
Offline
Re: How to highlight article title ... !?
erronious = erroneous
Not only your code is … ;-)
Offline
Re: How to highlight article title ... !?
The if_first_article
and if_last_article
trick isn’t really needed (or am I missing something?):
So this:
<txp:article_custom>
<txp:if_first_article><ul></txp:if_first_article>
<li<txp:if_article_id> class="active"</txp:if_article_id>><txp:permlink><txp:title /></txp:permlink></li>
<txp:if_last_article></ul></txp:if_last_article>
</txp:article_custom>
can just be this:
<txp:article_custom wraptag="ul">
<li<txp:if_article_id> class="active"</txp:if_article_id>><txp:permlink><txp:title /></txp:permlink></li>
</txp:article_custom>
Last edited by maniqui (2009-04-13 15:46:53)
Offline
#18 2009-04-13 20:37:05
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: How to highlight article title ... !?
maniqui wrote:
The
if_first_article
andif_last_article
trick isn’t really needed (or am I missing something?):
No, you didn’t miss anything, you’re right – as always :) It’s a left-over from the pre- wraptag
era ;)
Offline
#19 2010-06-17 11:34:23
- fantasmo
- Member
- Registered: 2010-05-05
- Posts: 40
Re: How to highlight article title ... !?
Hi,
i want to do the same thing, but with randomly chosen related_articles (I put them after the text of a single article)
I thought this would be very easy and tried the following thing:
In the form for the single article view i have:
<txp:related_articles limit="3" sort="rand()" wraptag="ul" break="" form="related_article" />
And in the form “related_article” i have:
<li <txp:if_last_article>class="last"</txp:if_last_article>>
<h3><txp:permlink><txp:title /></txp:permlink></h3>
<txp:article_image />
</li>
I really don’t get, why it doesn’t work…it always writes the class=“last” to EVERY related article.
Can anybody help please?
Offline
#20 2010-06-17 13:49:15
- fantasmo
- Member
- Registered: 2010-05-05
- Posts: 40
Re: How to highlight article title ... !?
Now i found a VERY bad solution..i take related_articles two times. In my article form I wrote:
<ul>
<txp:related_articles limit="2" sort="rand()" break="" form="related_article" />
<txp:related_articles limit="1" sort="rand()" break="" form="related_article" class="last" />
</ul>
I didn’t get that “article_custom”- or “if_firs/last_article”-thing to work…:-(
Still any help is very appreciated.
Offline
#21 2010-06-17 23:27:25
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: How to highlight article title ... !?
fantasmo wrote:
…it always writes the class=“last” to EVERY related article.
Did you check if it works if you use something else than sort="rand()"
? I wouldn’t be surprised if that is what’s causing the problem. offset
doesn’t work with sort="rand()"
either. It’s not like the query creates an article list in a random order and selects the first three, but rather it goes through the articles to select a random one three times. At least that’s how I imagine it works, I’m not a coder and I may be totally wrong ;)
As an alternative you can give zem_nth a try (though it might have the same problem).
Offline
Re: How to highlight article title ... !?
OK … and now this one:
The webpage > www.redfoxwebdesign.nl/new/info
So we have two lists of article titles of the same section with different categories, e.g. ‘inclusief’ and ‘optioneel’ …
The code >
<h4>Inclusief:</h4>
<txp:if_individual_article>
<txp:article_custom section="info" category="inclusief" sort="position asc" wraptag="ol" class="titles">
<li<txp:if_article_id> class="active"</txp:if_article_id>><txp:permlink><txp:title /></txp:permlink></li>
</txp:article_custom>
<txp:else />
<txp:article_custom section="info" category="inclusief" sort="position asc" wraptag="ol" class="titles">
<li<txp:if_first_article> class="active"</txp:if_first_article>><txp:permlink><txp:title /></txp:permlink></li>
</txp:article_custom>
</txp:if_individual_article>
<h4>Optioneel:</h4>
<txp:if_individual_article>
<txp:article_custom section="info" category="optioneel" sort="position asc" wraptag="ol" class="titles">
<li<txp:if_article_id> class="active"</txp:if_article_id>><txp:permlink><txp:title /></txp:permlink></li>
</txp:article_custom>
<txp:else />
<txp:article_custom section="info" category="optioneel" sort="position asc" wraptag="ol" class="titles">
<li<txp:if_first_article> class="active"</txp:if_first_article>><txp:permlink><txp:title /></txp:permlink></li>
</txp:article_custom>
</txp:if_individual_article>
Because of this piece of code I get TWO highlighted article titles on the landing page. But that’s not what I want … I only want the article title highlighted of the (only) article on the landing page, e.g. ‘Teksten’ … !?
I tried all kind of things with several TXP tags (if_article_category; if_category; etc.) but with no success. Any help is appreciated!
Last edited by RedFox (2010-07-19 19:49:35)
Offline
#23 2010-07-19 22:07:08
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: How to highlight article title ... !?
…maar wel met een hele grote strik!
LOL!
If the landing page article is always the first one in the ‘Optioneel’ menu, I think you only need to remove the <txp:if_first_article> class="active"</txp:if_first_article>
in the ‘Inclusief’ menu…
Offline
Re: How to highlight article title ... !?
Eh, no, although there will not be very many new articles, they will come sooner or later. And it can be an article in ‘Inclusief’ or ‘Optioneel’ … so, what to do … !?
Offline