Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-08-15 07:21:16

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,359
Website

evaluate and default

I know I could use variables but this was just an experiment. The default global has an odd behaviour when used in the context below returning 1 if the image’s alt field has, or has not been filled. Is this expected?

<txp:images id="##">
<txp:evaluate test='<txp:image_info type="alt" />' default="alt text" />
</txp:images>

Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.

Offline

#2 2020-08-15 07:48:58

etc
Developer
Registered: 2010-11-11
Posts: 3,989
Website

Re: evaluate and default

colak wrote #325354:

Is this expected?

Actually, nothing is expected in this case, since <txp:evaluate /> expects either content or query attribute to be provided. But we can tweak it to cover such situations too.

But why wouldn’t you use just

<txp:image_info type="alt" default="alt text" />

Offline

#3 2020-08-15 07:59:28

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,359
Website

Re: evaluate and default

etc wrote #325357:

Actually, nothing is expected in this case, since <txp:evaluate /> expects either content or query attribute to be provided. But we can tweak it to cover such situations too.

But why wouldn’t you use just

<txp:image_info type="alt" default="alt text" />...

I could. This was just an experiment:)


Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.

Offline

#4 2020-08-15 08:05:39

etc
Developer
Registered: 2010-11-11
Posts: 3,989
Website

Re: evaluate and default

colak wrote #325359:

This was just an experiment:)

Will work as expected in 4.8.3 :-)

Offline

Board footer

Powered by FluxBB