Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-11-10 08:42:47

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

Need some help with <txp:if_individual_article>!

On this landingpage (only tested in Firefox!) > www.redfoxwebdesign.nl/new/info the lists in the sidebar are contructed as follows >

<h4>Inclusief:</h4>
        <txp:if_individual_article>
	<txp:article_custom section="info" category="inclusief" sort="position asc">
		<txp:if_first_article><ol class="titles"></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></ol></txp:if_last_article>
	</txp:article_custom>
<txp:else />
	<txp:article_custom section="info" category="inclusief" sort="position asc">
		<txp:if_first_article><ol class="titles"></txp:if_first_article>
		<li<txp:if_first_article> class="active"</txp:if_first_article>><txp:permlink><txp:title /></txp:permlink></li>
		<txp:if_last_article></ol></txp:if_last_article>
        </txp:article_custom>
        </txp:if_individual_article>
<h4>Optioneel:</h4>
	<txp:if_individual_article>
	<txp:article_custom section="info" category="optioneel" sort="position asc">
		<txp:if_first_article><ol class="titles"></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></ol></txp:if_last_article>
	</txp:article_custom>
<txp:else />	
       <txp:article_custom section="info" category="optioneel" sort="position asc">
		<txp:if_first_article><ol class="titles"></txp:if_first_article>
		<li<txp:if_first_article> class="active"</txp:if_first_article>><txp:permlink><txp:title /></txp:permlink></li>
		<txp:if_last_article></ol></txp:if_last_article>
	</txp:article_custom>
</txp:if_individual_article>

And as you can see there are two (2) ‘active’ titles. Now the question is, what must I do to make one (1) title ‘active’ depending on the cat (‘inclusief’ or ‘exclusief’) of the article (on the landingpage!)? Thanks for any help!

Offline

#2 2009-11-10 09:56:01

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,549
Website GitHub Twitter

Re: Need some help with <txp:if_individual_article>!

Hi redfox

Have you tried to use the tag

<txp:if_category name="inclusif">

in your code, i think it can solve your problem

Offline

#3 2009-11-10 15:34:32

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

Re: Need some help with <txp:if_individual_article>!

Dragondz > Yes, I did … but I can’t find a place where it does the job as wanted!

Offline

#4 2009-11-10 15:58:00

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,549
Website GitHub Twitter

Re: Need some help with <txp:if_individual_article>!

I havent understund what you are trying to do?

Are you meaning : only one h4 title must be displayed depending on individual article?

Where “exclusief” category code, i see inclusief and optioneel !

If i understund (i try) you can do this:

<txp:if_individual_article>
     <txp:if_category name="inclusief">
        <h4>Inclusief:</h4>
	<txp:article_custom section="info" category="inclusief" sort="position asc">
		<txp:if_first_article><ol class="titles"></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></ol></txp:if_last_article>
	</txp:article_custom>
</txp:if_category>
<txp:else />
        <h4>Inclusief:</h4>
	<txp:article_custom section="info" category="inclusief" sort="position asc">
		<txp:if_first_article><ol class="titles"></txp:if_first_article>
		<li<txp:if_first_article> class="active"</txp:if_first_article>><txp:permlink><txp:title /></txp:permlink></li>
		<txp:if_last_article></ol></txp:if_last_article>
        </txp:article_custom>
        </txp:if_individual_article>
<txp:if_individual_article>
<txp:if_category name="optioneel">
<h4>Optioneel:</h4>
	<txp:article_custom section="info" category="optioneel" sort="position asc">
		<txp:if_first_article><ol class="titles"></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></ol></txp:if_last_article>
	</txp:article_custom>
</txp:if_category>
<txp:else />	
<h4>Optioneel:</h4>
       <txp:article_custom section="info" category="optioneel" sort="position asc">
		<txp:if_first_article><ol class="titles"></txp:if_first_article>
		<li<txp:if_first_article> class="active"</txp:if_first_article>><txp:permlink><txp:title /></txp:permlink></li>
		<txp:if_last_article></ol></txp:if_last_article>
	</txp:article_custom>
</txp:if_individual_article>

Offline

#5 2009-11-10 16:45:35

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

Re: Need some help with <txp:if_individual_article>!

Are you meaning : only one h4 title must be displayed depending on individual article?

Yes … it’s ok on every individual article page … but now I want the same thing on the landingpage (Info). A highlighted title of the article shown!

Offline

#6 2009-11-11 10:31:46

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,549
Website GitHub Twitter

Re: Need some help with <txp:if_individual_article>!

Hi RedFox

you mean in list mode?

Hum, if you can get the id of the article chown on landing page i think it’s possible, you can get the id by putting it in a txp:variable eg: in landing page make in the form you use to display the article: <txp:variable name=“mainid” value=’<txp:article_id />’ />

and in you title column make for ex:

<txp:article_custom section="info" category="optioneel" sort="position asc">
		<txp:if_first_article><ol class="titles"></txp:if_first_article>
<txp:if_variable name="mainid" value='<txp:article_id />'>
                 <li class="highlight<txp:if_first_article>,active</txp:if_first_article>"><txp:permlink><txp:title /></txp:permlink></li>
<txp:else />
		<li<txp:if_first_article> class="active"</txp:if_first_article>><txp:permlink><txp:title /></txp:permlink></li>
</txp:if_variable>
		<txp:if_last_article></ol></txp:if_last_article>
	</txp:article_custom>

NB: not tested

Offline

#7 2009-11-11 10:32:54

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,549
Website GitHub Twitter

Re: Need some help with <txp:if_individual_article>!

Dragondz a écrit:

Hi RedFox

you mean in list mode?

Hum, if you can get the id of the article chown on landing page i think it’s possible, you can get the id by putting it in a txp:variable eg: in landing page make in the form you use to display the article: <txp:variable name=“mainid” value=’<txp:article_id />’ />

and in you title column make for ex:

<txp:article_custom section="info" category="optioneel" sort="position asc">
		<txp:if_first_article><ol class="titles"></txp:if_first_article>
<txp:if_variable name="mainid" value='<txp:article_id />'>
                 <li class="highlight<txp:if_first_article>,active</txp:if_first_article>"><txp:permlink><txp:title /></txp:permlink></li>
<txp:else />
		<li<txp:if_first_article> class="active"</txp:if_first_article>><txp:permlink><txp:title /></txp:permlink></li>
</txp:if_variable>
		<txp:if_last_article></ol></txp:if_last_article>
	</txp:article_custom>

NB: not tested and you must save the variable mainid before you call the right column

Offline

#8 2010-02-14 10:16:38

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

Re: Need some help with <txp:if_individual_article>!

See this TXP Tip > txptips.com/highlight-the-active-article-title for more info!

Offline

Board footer

Powered by FluxBB