Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-04-18 11:25:06

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

logic for image caption

I’d like to prepend a copyright symbol to the caption of an image. The symbol shouldn’t appear if not caption has been added.

I tried using a combination of chh_if_data and upm_image, but the © is output in all cases – whether or not a caption exists.

<p class="credit"><txp:chh_if_data>&copy; <txp:upm_img_alt /></txp:chh_if_data></p>

Is there another way to achieve this?

thanks
Stu

Offline

#2 2008-04-18 11:44:44

sthmtc
Member
From: CGN, GER
Registered: 2005-01-17
Posts: 586
Website

Re: logic for image caption

shouldn’t you be using <txp:upm_img_caption /> ?

Offline

#3 2008-04-18 11:54:47

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: logic for image caption

yes, sorry – my typo
the same problem applies though

<p class="credit"><txp:chh_if_data>&copy; <txp:upm_img_caption /></txp:chh_if_data></p>

Offline

#4 2008-04-18 12:00:10

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

Re: logic for image caption

And if for some reason chh_if_data doesn’t work, as it could be, but the changes are quite small, then you can use little tiny php statement:

<txp:php> if(upm_img_alt(array())) echo '&copy; '; </txp:php>

Expecting that upm_img_alt is a function and not formed by custom parser – it definetly should be function, shouldn’t it? :)

Offline

#5 2008-04-18 13:22:30

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: logic for image caption

my apologies – the chh_if_data plugin does work – I was being a numpty ;-o
sorry to waste your time
Stu

Offline

#6 2008-04-18 14:29:19

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

Re: logic for image caption

pieman wrote:

my apologies – the chh_if_data plugin does work – I was being a numpty ;-o

So, what was the problem?

Offline

Board footer

Powered by FluxBB