Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-06-12 03:40:35

shaz
New Member
Registered: 2006-06-12
Posts: 6

using custom fields

hi, i have tried to look this up, but didnt find anything really helpful, sorry for posting if it already exists.

i am trying to use custom fields in the img tag, or also within a plugin tag, eg. below…

<pre>&lt;txp:rss_thumbpop mode=“float” label=“My Pictures” orderby=“caption” pagepop=“1” padheight=“100” <br />category=”&lt;txp:custom_field name=“FieldName” /&gt;” /&gt;</pre>

It is sort of working… meaning it is getting the image, but its ignoring the other attributes.

Anyways, all I really want to know is how could I get the custom field tag to work within “img” or the plugin tag above. Please let me know if anyone has any ideas.

thanks!

(Edit: updated so your code would display properly. :) -Mary)

Last edited by shaz (2006-06-12 03:48:42)

Offline

#2 2006-06-12 09:09:02

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: using custom fields

Hello shaz,

unless rss_thumbpop takes special care to parse its own attributes then I doubt your example will work. It’s known as the tags-in-tags problem and it has seen a bit of discussion on the forum lately (here and here)

Just so happens that the last release of my PCF plugin (see here) has replacement image and thumbnail tags that can get their attributes from a custom field. Please give it a try and feedback with comments thoughts or bugs over on that thread and I’ll see what can be one to help.


Steve

Offline

#3 2006-06-12 19:51:49

shaz
New Member
Registered: 2006-06-12
Posts: 6

Re: using custom fields

hi, thanks. so bacially tag in tag doesnt work. ok. still looking for a full solution, wondering if there is a way to call in a form depending on the article id… similar to article_image tag. thanks.

Offline

#4 2006-06-12 20:02:31

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: using custom fields

You can probably do it with php, like mentioned in this FAQ. I’m not good with php, so if you can’t figure it out yourself you’ll have to ask someone else to tell you how to do it :/

Offline

#5 2006-06-12 20:53:47

shaz
New Member
Registered: 2006-06-12
Posts: 6

Re: using custom fields

thanks, yes I saw these in the faqs but the thing is that I dont know php, so thats y I thought I would ask here, but didnt get much feedback. thanks for your help tho.

Offline

#6 2006-06-12 23:13:11

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: using custom fields

You place the following in your article form:

<txp:php>
global $thisarticle;

echo rss_thumbpop(array(
	'label'     => 'My Pictures',
	'mode'      => 'float',
	'orderby'   => 'caption',
	'padheight' => '100',
	'pagepop'   => '1',
	'category'  => custom_field(array('name' => 'FieldName'))
));
</txp:php>

:)

Last edited by Mary (2006-06-14 18:41:52)

Offline

#7 2006-06-13 13:32:41

shaz
New Member
Registered: 2006-06-12
Posts: 6

Re: using custom fields

Thanks Mary. I tried it and got this error…

Parse error: parse error, unexpected ‘=’, expecting ‘)’ in /mnt/w0502/d33/s29/b0272de7/www/diy-design/clients/creativebag/textpattern/publish/taghandlers.php(1731) : eval()’d code on line 3

I guess I’m doing something wrong… any ideas?

Offline

#8 2006-06-13 19:00:36

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: using custom fields

Ah, nope, I was missing a comma. I’ve correct the code above, try again? :)

Offline

#9 2006-06-14 02:57:31

shaz
New Member
Registered: 2006-06-12
Posts: 6

Re: using custom fields

thanks again Mary… that is almost working. The only thing is that now, its just displaying all images… while its supposed to only display the images that are within the catagory.

Offline

#10 2006-06-14 12:40:37

shaz
New Member
Registered: 2006-06-12
Posts: 6

Re: using custom fields

ok, I tried every different variation of this, on all the different pages and still nothing! I get an error if I put it directly into the article, I get all the images show up if I use it on the ‘page’ template or if I use a form?? If I to use “echo” and just the part about the custom_field, even that is not working, so I am wondering if the custom_field is even working?

Alternatively, (which would be a bit more untidy, but could work) I could use a form for each article, and put the info in a form, so at least I don’t have to make a ‘page’ for everything, I could just the same ‘page’ template, and then call in a form with a name that matches the article ID… is there an easy way to do that at least? Something similar to the article_image tag, but instead article_form?? thanks for the help!

Offline

#11 2006-06-14 18:42:04

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: using custom fields

It needs to be inside your article form. It might be that we need to global the thisarticle variable.

Offline

Board footer

Powered by FluxBB