Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-07-22 19:14:17

silent7
Member
From: Los Angeles, CA
Registered: 2005-03-25
Posts: 17
Website

Custom field as for an image ID

is it possible to have an custom form for a image ID

This is what I have right now and its returning a 500 Error

<txp:thumbnail id="<txp:custom_field name="Thumbnail1" />" />

Ohh ya in the custom field I have the ID of the image such as 7

Last edited by silent7 (2007-07-22 19:17:52)

Offline

#2 2007-07-22 19:54:45

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,634
GitHub Twitter

Re: Custom field as for an image ID

Hi,
It’s not allowed to use directly TXP tags into tags.

Assuming you use it into a form, try this :

<txp:thumbnail id="<txp:php>
global $thisarticle;
echo custom_field(array(
'name'=>'Thumbnail1',
));</txp:php>" />

Last edited by Pat64 (2007-07-22 19:56:21)


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#3 2007-07-22 20:00:45

silent7
Member
From: Los Angeles, CA
Registered: 2005-03-25
Posts: 17
Website

Re: Custom field as for an image ID

Ahh no dice. Same 500 error

Offline

#4 2007-07-22 20:14:54

silent7
Member
From: Los Angeles, CA
Registered: 2005-03-25
Posts: 17
Website

Re: Custom field as for an image ID

well I take out the code and it works. and have the <txp:thumbnail id="17" /> in the custom field

but If I put the <txp:thumbnail id="<txp:custom_field name="Thumbnail1" />" /> it wont work, I get the 500, I have all the PHP support turned on too.

Offline

#5 2007-07-22 20:16:53

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Custom field as for an image ID

Um, well you can’t use <txp:php> directly inside another TXP tag either, but this should work:

<txp:php>
  echo thumbnail(array('id' => custom_field(array('name' => 'Thumbnail1'))));
</txp:php>

Offline

#6 2007-07-22 20:26:34

silent7
Member
From: Los Angeles, CA
Registered: 2005-03-25
Posts: 17
Website

Re: Custom field as for an image ID

ahh its not working, I’ll just do it the regular way and put the whole txp:thumnail tag in the custom field and not just the ID

Offline

#7 2007-07-22 20:34:09

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

Re: Custom field as for an image ID

Well, or if you don’t feel yourself comfortable around the php, you can just use a one plugin: asy_wondertag which allows you to put tags inside tags, or otherhands tags as attributes.

Install asy_wondertag, and then use it, like this:

<txp:asy_wondertag><txp:thumbnail id="<txp:custom_field name="Thumbnail1" />" /></txp:asy_wondertag>

Last edited by Gocom (2007-07-22 20:34:56)

Offline

#8 2007-07-23 06:03:31

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

Re: Custom field as for an image ID

Is there a reason you are not using article image?


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

Offline

#9 2007-07-23 06:16:22

silent7
Member
From: Los Angeles, CA
Registered: 2005-03-25
Posts: 17
Website

Re: Custom field as for an image ID

yes I have 2 rows of 3 thumbnails each all of which are being shown on one page as a portfolio presentation. I just wanted to make it simpler to do and update with just having to put the ID of the image number for each project in one of the 6 fields I have marked as thumbnails in the custom fields. Not having to put the whole txp tag in there also that way if I wanted to make the lightbox plugin work and re purpose the ID which was in the custom field already for the larger image link, later on.

Offline

#10 2007-07-23 09:53:44

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

Re: Custom field as for an image ID

would expanding the article image possibilities help?

Last edited by colak (2007-07-23 09:54:46)


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

Offline

#11 2007-07-25 10:57:59

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,634
GitHub Twitter

Re: Custom field as for an image ID

:) :)

The best way is to use one of these :

<txp:ruud> (...) all you need here (...) </txp:ruud>
<txp:mary> (...) all you need here (...) </txp:mary>
<txp:wet> (...) all you need here (...) </txp:wet>
<txp:senser> (...) all you need here (...) </txp:senser>

Work (very) fine for me!

:) :)


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#12 2007-07-25 11:56:35

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Custom field as for an image ID

Several solutions have already been posted. If those give a HTTP 500 error, then I’d recommend looking at the error logs to find what causes that error.

Offline

Board footer

Powered by FluxBB