Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-05-23 17:36:21

lous
Member
From: Germany
Registered: 2009-01-04
Posts: 57

double txp:if_custom_field?

Hey,
is it possible to put 2 if custom fields in the code?
Im aiming to say something like “If language = Deutsch, then de.png, If language = Englisch, then en.png, else custom_field”

<txp:if_custom_field name="sprache" val="Deutsch">
    <td><img height="11" width="16" alt="German" src="de.png></td>
<txp:if_custom_field name="sprache" val="Englisch">
    <td><img height="11" width="16" alt="English" src="en.png></td>
<txp:else/>
    <td><txp:custom_field name="sprache" /> </td>
</txp:if_custom_field>

thanks in advance :))

Offline

#2 2009-05-23 17:44:09

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: double txp:if_custom_field?

Nest conditional tags properly:

<txp:if_conditional_1>
	...
<txp:else />
	<txp:if_conditional_2>
		...
	<txp:else />
		...
	</txp:if_conditional_2>
</txp:if_conditional_1>

Offline

#3 2009-05-23 17:45:35

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: double txp:if_custom_field?

<txp:if_custom_field name="sprache">
    <txp:if_custom_field name="sprache" val="Deutsch">
        <td><img height="11" width="16" alt="German" src="de.png></td>
    </txp:if_custom_field>
    <txp:if_custom_field name="sprache" val="Englisch">
        <td><img height="11" width="16" alt="English" src="en.png></td>
    </txp:if_custom_field>
<txp:else/>
    <td><txp:custom_field name="sprache" /> </td>
</txp:if_custom_field>

Offline

#4 2009-05-23 17:48:11

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: double txp:if_custom_field?

And guess what? It’s even in Textbook: Tag Nesting :)

Offline

#5 2009-05-23 18:26:46

masa
Member
From: Asturias, Spain
Registered: 2005-11-25
Posts: 1,091

Re: double txp:if_custom_field?

Els wrote:

And guess what? It’s even in Textbook: Tag Nesting :)

Isn’t Textpattern great – logical and intuitive!

Offline

#6 2009-05-23 19:00:41

lous
Member
From: Germany
Registered: 2009-01-04
Posts: 57

Re: double txp:if_custom_field?

haha :D sorry it works now :D thanks. But another quesiton. Im using this code for the article list

<txp:if_article_list>
<div class="content_head">
        <h1><txp:category title="y" /></h1>
      </div>
      <div class="content_main">
      <table class="dllist" width="657" align="center">
         <tr class="title">
            <td width="332">Titel</td>
            <td width="81">Kategorie</td>
            <td width="60">Sprache</td>
            <td width="74">Größe</td>
            <td width="59">Klicks</td>
          </tr>
           <txp:output_form form="article_list" />
       </table>
      </div>
      <div class="content_foot"></div>
</txp:if_article_list>

And the “article_list” form

<txp:if_category>
<txp:if_category name="filme">
<txp:article_custom category="filme" form="article_listing" limit="10" pgonly="0" section="downloads" sort="Posted desc" status="4" time="any" />
</txp:if_category>
<txp:if_category name="dvd">
<txp:article_custom category="dvd" form="article_listing" limit="10" pgonly="0" section="downloads" sort="Posted desc" status="4" time="any" />
</txp:if_category>
and so on....

And last but not least “article_listing”

<tr>
    <td><txp:permlink><txp:title /></txp:permlink></td>
    <td><txp:category2 link="1" /></td>
    <td><txp:custom_field name="sprache" /> </td>
    <td><txp:custom_field name="größe" /> MB</td>
    <td><txp:custom_field name="countxx" /></td>
</tr>
<txp:rsx_page_number_list nav='1' leftward='[&lt;&lt; Prev]' rightward='[Next &gt;&gt;]' delim=' ' windowsize='10' />

But the page number wont work, does anyone know why? Or is there a pagenavi also inside of txp?

Offline

#7 2009-05-23 19:30:57

lous
Member
From: Germany
Registered: 2009-01-04
Posts: 57

Re: double txp:if_custom_field?

hmmmmm
once the if thing works,

<txp:if_custom_field name="sprache" val="Deutsch">
<td><img height="11" width="16" alt="German" src="de.png></td>
<txp:else/>
<td><txp:custom_field name="sprache" /> </td>
</txp:if_custom_field>

but now even that doesnt work anymore, my list is completly destroyed when i use that

Offline

#8 2009-05-23 19:55:03

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: double txp:if_custom_field?

Pagination doesn’t work with the article_custom tag. You can try a plugin, chh_article_custom (using the chh_article tag). Note that the plugin is not maintained anymore (but as far as I know still works).

Offline

#9 2009-05-23 20:10:48

lous
Member
From: Germany
Registered: 2009-01-04
Posts: 57

Re: double txp:if_custom_field?

Hmm i tried to use

<chh_article_custom category="filme" form="article_listing" />

instead of

<txp:article_custom category="filme" form="article_listing" limit="10" pgonly="0" section="downloads" sort="Posted desc" status="4" time="any" />

but no output

I mean, everything works how i want it with “txp:article_custom” but the only thing thats missing is a page navi like Page 1 2 3 4 of the current article list

Last edited by lous (2009-05-23 20:12:55)

Offline

#10 2009-05-23 20:30:02

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: double txp:if_custom_field?

I wrote:

(using the chh_article tag)

Offline

#11 2009-05-23 21:43:10

lous
Member
From: Germany
Registered: 2009-01-04
Posts: 57

Re: double txp:if_custom_field?

i also tried <chh_article_custom category=“filme” form=“article_listing” /> but also no output :(

Offline

#12 2009-05-23 22:04:05

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: double txp:if_custom_field?

Tags are written with appending <txp:, so it is <txp:chh_..... not <chh..

Offline

Board footer

Powered by FluxBB