Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-01-20 17:26:18

elihu252
Member
Registered: 2006-10-27
Posts: 23

Insert a custom field inside a line of code?

Is there any way at all I can insert a custom field inside a line of code?

Essentially I want my form to look something like <img src=”<txp:custom field name>” /> and that would print out <img src=“imagename.jpg”>

Offline

#2 2008-01-20 17:37:02

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

Re: Insert a custom field inside a line of code?

yes you can do that, although it should read something like

<txp:if_custom_field name="image"><img src="<txp:custom field name="image" />" /></txp:if_custom_field>

Note that the code needs to reside in an article form and presupposes a custom field the name of which is “image”…

Edit… Also if you know that your images are always going to be jpgs you can have something like

<txp:if_custom_field name="image"><img src="<txp:custom field name="image" />.jpg" /></txp:if_custom_field>

which is going to save you some typing long term.

Last edited by colak (2008-01-20 17:57:48)


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

Offline

#3 2008-01-20 20:55:04

elihu252
Member
Registered: 2006-10-27
Posts: 23

Re: Insert a custom field inside a line of code?

cool ill try it out

Offline

#4 2008-01-20 23:13:11

elihu252
Member
Registered: 2006-10-27
Posts: 23

Re: Insert a custom field inside a line of code?

worked perfect thanks

Offline

Board footer

Powered by FluxBB