Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-12-03 04:12:23

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,172
Website GitHub Mastodon Twitter

[SOLVED] article_image as custom_field with multiple ids

Can anyone see what I am doing wrong here? I am aware that I am using a “feature” of txp but is there a non plugin way for the article_image field to accept a comma separated list of image ids? The code below only returns the first image

<txp:if_article_image>
<txp:images sort="rand()" limit="1">
<txp:image id='<txp:custom_field name="article_image" />' />
</txp:images>
</txp:if_article_image>

I also tried

<txp:variable name="aimg" value='<txp:article_image />' />
<txp:if_variable name="aimg" value="">&nbsp;<txp:else />
<txp:images sort="rand()" limit="1">
<txp:image id='<txp:variable name="aimg" />' />
</txp:images>
</txp:if_variable>

but nothing is returned

and

<txp:variable name="aimg" value='<txp:custom_field name="article_image" />' />
<txp:if_variable name="aimg" value="">&nbsp;<txp:else />
<txp:images sort="rand()" limit="1">
<txp:image id='<txp:variable name="aimg" />' />
</txp:images>
</txp:if_variable>

which returns the same results as the first code

Last edited by colak (2012-12-03 04:53:53)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#2 2012-12-03 04:53:38

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,172
Website GitHub Mastodon Twitter

Re: [SOLVED] article_image as custom_field with multiple ids

solved it:)

Here’s the code if anyone needs it

<txp:variable name="aimg" value='<txp:custom_field name="article_image" />' />
<txp:if_variable name="aimg" value="">&nbsp;<txp:else />
<txp:images sort="rand()" limit="1" id='<txp:variable name="aimg" />' >
<txp:image />
</txp:images>
</txp:if_variable>

Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB