Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2009-08-25 18:08:47
- brown
- New Member
- Registered: 2009-08-25
- Posts: 5
calling custom_name value within image tag
I’m a newbie, so please be gentle.
Inside of a form, this works:
<txp:if_custom_field name=“picture2”>
<img src=“images/<txp:custom_field name=“picture2”/>” class=“rightcolumnpics”>
</txp:if_custom_field>
But this does not:
<txp:if_custom_field name=“picture2”>
<txp:image id=’<txp:custom_field name=“picture2” escape=”“ />’ class=“rightcolumnpics” />
</txp:if_custom_field>
I need to use the second method for reasons that are not important here. Why can’t I get it to work? If I replace the <txp:custom_field> tage in the second example with a direct reference to a number, e.g. “200” it works. So why can’t I pull the value from the custom_field tag?
Offline
Re: calling custom_name value within image tag
Not sure if the escape=""
is in the right place – have you tried to move it like so:
<txp:if_custom_field name=“picture2”>
<txp:image id=’<txp:custom_field name=“picture2” />’ escape=”“ class=“rightcolumnpics” />
</txp:if_custom_field>
Offline
#3 2009-08-25 18:22:53
- brown
- New Member
- Registered: 2009-08-25
- Posts: 5
Re: calling custom_name value within image tag
I tried that but it still doesn’t work. It makes me wonder if it’s possible to called <txp:custom_field /> within another textpattern tag.
Offline
Re: calling custom_name value within image tag
Should be ok if you are using 4.08 – assume you are? And have you tested the same code you have with a hard coded reference to the image number?
Offline
#5 2009-08-25 18:29:06
- brown
- New Member
- Registered: 2009-08-25
- Posts: 5
Re: calling custom_name value within image tag
The answer to your second question is yes – I have tested it work a hard coded reference and it works perfectly.
To the first, I’m still running 4.04. Maybe that’s my problem. I’ll see what I can do. I’m new to textpattern so have not had the pleasure of upgrading. I’m sure there’s an FAQ for that. Thanks
Offline
Re: calling custom_name value within image tag
Well that’s the answer. Tags is tags was introduced only with TXP 4.07, so if you want your code to work, then you should upgrade. You should anyway, but that’s another matter!
Offline
#7 2009-08-25 18:56:35
- brown
- New Member
- Registered: 2009-08-25
- Posts: 5
Re: calling custom_name value within image tag
I haven’t upgraded because I’ve never been able to actually find what is referred to as the .htaccess (something like that) file that apparently must be deleted in order to do the upgrade. That and I’m just a little nervous about deleting files in root directories and such. But now I’ll have to.
Thanks for your help.
Offline
Re: calling custom_name value within image tag
If you are on a Mac, then the file is hidden by default. If you use an FTP/SFTP app like Transmit you can see the file.
4.08 (and the soon to be released 4.20) both include an .htaccess file which needs to reside in your root folder. You can just drag it over and it will overwrite the file.
If you have any questions on upgrading, best post another thread so that we can help with that particular matter.
Offline
#9 2009-08-25 23:45:43
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: calling custom_name value within image tag
brown,
if you can’t upgrade you can use the asy_wondertag plugin for nesting tags.
Offline
#10 2009-08-26 15:08:27
- brown
- New Member
- Registered: 2009-08-25
- Posts: 5
Re: calling custom_name value within image tag
Thanks everybody. I upgraded last night – it was actually easier than I thought. The only issue is the security problem with the globals in the .htaccess. I tried to uncomment that line and got the server 500 error. But I’m sure I can work that out over time. As soon as I upgrade, my code worked beautifully just as Jonathan said.
Offline