Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-06-06 18:37:20

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 687
Website Mastodon

Sort depending on nested terms of custom field values

Hello there,

is there any way for me to sort articles depending on values in nested custom field terms, like

<txp:if_custom_field name=“feature” val=“yes”>
<txp:if_custom_field name=“big” val=“yes”>
<p>I am featured AND I am big!</p>
</txp:if_custom_field>
</txp:if_custom_field>

I can’t seem to be able to nest those terms involving custom field values.
i am on 4.0.5 in this case.


A hole turned upside down is a dome, when there’s also gravity.

Offline

#2 2008-06-06 18:49:22

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

Re: Sort depending on nested terms of custom field values

Nesting tags isn’t currently possible, but it will be on 4.0.7.

You can try is this:

<txp:if_custom_field name=“feature” val=“yes”>
<txp:output_form form="is_big" />
</txp:if_custom_field>

form “is_big”:

<txp:if_custom_field name=“big” val=“yes”>
<p>I am featured AND I am big!</p>
</txp:if_custom_field>

This way, nested same tags usually works.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#3 2008-06-08 06:45:48

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: Sort depending on nested terms of custom field values

If moving up to the current svn revision for 4.0 is comfortable for you it’s well worth the advantages. I’m using the form that follows with jnm_audio with excellent results on a site I’m building for a friend.
It employs 2 custom fields, and the only burden on the user is the choice of whether to use the download id or the filename field.

<txp:if_custom_field name="music_file_id">
<fieldset>
<legend><txp:custom_field name="music_filename" /></legend>
<txp:jnm_audio fileid='<txp:custom_field name="music_file_id" />' />
</fieldset>
<txp:else />
<txp:if_custom_field name="music_filename">
<fieldset>
<legend><txp:custom_field name="music_filename" /></legend>
<txp:jnm_audio filename='<txp:custom_field name="music_filename" />' />
</fieldset>
</txp:if_custom_field>
</txp:if_custom_field>

Last edited by rsilletti (2008-06-09 05:12:39)

Offline

#4 2008-06-09 11:54:57

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 687
Website Mastodon

Re: Sort depending on nested terms of custom field values

Thank you very much, both.
I am using Maniqui’s method now, as i shouldn’t update a client’s website to an svn version.
Thanx very much again.


A hole turned upside down is a dome, when there’s also gravity.

Offline

#5 2008-06-09 17:28:11

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: Sort depending on nested terms of custom field values

That is wise given the nature of some of the changes, even were it not svn it may lead to a significant amount of editing amongst some of the defined attributes in older templates.

Offline

Board footer

Powered by FluxBB