Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
<txp:if_image_info /> tag possibility?
Haven’t thought this through totally myself, but wonder if there is a possibility of a <txp:if_image_info /> tag nested within a <txp:images /> tag in the future, like so…
<txp:if_image_info type="caption"><figcaption><txp:image_info type="caption" /></figcaption></txp:if_image_info>
Or another usage…
<txp:if_image_info type="category" value=""><p>Uncategorised</p></txp:if_image_info>
Offline
#2 2011-06-29 22:26:54
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: <txp:if_image_info /> tag possibility?
Why create new conditional tags if it can be done with variable/if_variable?
Offline
Re: <txp:if_image_info /> tag possibility?
Oh, of course, I said I had not thought this through too much! We can use…
<txp:variable name="if_caption" value="<txp:image_info type='caption' />" />
<txp:if_variable name="if_caption" value="">
<txp:else />
<figcaption><txp:image_info type='caption' /></figcaption>
<txp:if_variable>
Although we can just use <txp:image_info />
without the type, as caption is the default – I’ve just put that in there to make it easier to understand.
Thanks.
Last edited by philwareham (2011-06-30 08:24:08)
Offline
Re: <txp:if_image_info /> tag possibility?
philwareham wrote:
Oh, of course, I said I had not thought this through too much! We can use…
Exactly, just flip the quotes (straight quotes surrounding the attribute values containing tags), and you can also use the variable itself to return the value, like so:
<txp:variable name="caption" value='<txp:image_info type="caption" />' />
<txp:if_variable name="caption" value="">
<txp:else />
<figcaption><txp:variable name="caption" /></figcaption>
<txp:if_variable>
:)
Offline
Re: <txp:if_image_info /> tag possibility?
I always get the quotes mixed up first time, shortest method then is…
<txp:variable name="caption" value="<txp:image_info />" />
<txp:if_variable name="caption" value="">
<txp:else />
<figcaption><txp:image_info /></figcaption>
</txp:if_variable>
Last edited by philwareham (2011-07-03 15:39:00)
Offline
#6 2011-06-30 22:41:07
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: <txp:if_image_info /> tag possibility?
Offline