Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-09-18 09:51:37

DrRogg
New Member
From: Tokyo, Japan
Registered: 2007-09-18
Posts: 4
Website

Passing a variable straight to a tag handler in txp:php

I’m a bit of PHP newbie, so I need some help with this one. I have a bunch of articles with image IDs saved in custom field 1, that I’d like to pass straight on to the txp:image function.

Obviously <txp:image id="<txp:custom_field name="custom1" />" /> is out, so I’ve got:

<txp:php>
$coverid = custom_field (array('name' => 'Cover Image ID (Main)'));
</txp:php>

to pull out the custom field content; how can I pass it on as an ID to use with the image() handler?

Thanks,
Rog

Offline

#2 2007-09-18 09:57:27

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: Passing a variable straight to a tag handler in txp:php

Two possible solutions:

  1. Use asy_wondertag
  2. Read The Gordian Knot

Offline

#3 2007-09-19 04:22:27

DrRogg
New Member
From: Tokyo, Japan
Registered: 2007-09-18
Posts: 4
Website

Re: Passing a variable straight to a tag handler in txp:php

Thanks for the Gordian Knot link, I’ve got it sorted ;)

Rog

Offline

Board footer

Powered by FluxBB