Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#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

#14 2009-03-26 23:20:10

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 809
Website

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

#16 2009-03-26 23:43:54

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 809
Website

Re: How to highlight article title ... !?

erronious = erroneous

Not only your code is … ;-)

Offline

#17 2009-04-13 15:46:30

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

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)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

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 and if_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

#22 2010-07-19 19:48:48

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 809
Website

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

#24 2010-07-20 14:45:53

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 809
Website

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

Board footer

Powered by FluxBB