Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2006-10-19 00:08:34
- ballmann
- Member
- Registered: 2006-10-14
- Posts: 37
assign an url to <txp:article_image />
hi everybody!
i got several articles and some of them use an article-image (<txp:article_image />). for these articles i want to link this images to some urls (a different one for each article). how can i easily set up a custom-field in the article-template in which i can paste a url – which is automatically linked to the article-image of this specific article?
any ideas?
i think it´s not that hard but searchin this forum did´nt bring the solution.
thank you!
Offline
#2 2006-10-19 06:09:24
- mstwntd
- Member
- From: Melbourne, Australia
- Registered: 2004-12-25
- Posts: 52
Re: assign an url to <txp:article_image />
Edit: Syntax error corrected
Hi ballmann,
- Create a new Custom Field named img-url
- In your Article Form, you can set it up like this:
<a<txp:if_custom_field name="img-url"> href="<txp:custom_field name="img-url" />"</txp:if_custom_field>><txp:article_image /></a>
Last edited by mstwntd (2006-10-19 11:03:21)
Offline
#3 2006-10-19 09:52:33
- ballmann
- Member
- Registered: 2006-10-14
- Posts: 37
Re: assign an url to <txp:article_image />
hi mstwntd, it´s not working.
are your sure the syntax is right?
here is my basic code:
<h2><txp:title /></h2>
<txp:article_image />
<txp:body />
<txp:excerpt />
Offline
#4 2006-10-19 11:00:33
- mstwntd
- Member
- From: Melbourne, Australia
- Registered: 2004-12-25
- Posts: 52
Re: assign an url to <txp:article_image />
My bad, ballmann. I forgot to close <txp:custom_field name="img-url" />
.
Offline
#5 2006-10-19 17:27:12
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: assign an url to <txp:article_image />
The article image input already accepts urls.
Offline
#6 2006-10-19 18:57:02
- ballmann
- Member
- Registered: 2006-10-14
- Posts: 37
Re: assign an url to <txp:article_image />
mary, what do you mean?
i want do assign a specific url to an image – not the url to the image.
Offline
#7 2006-10-19 20:10:14
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: assign an url to <txp:article_image />
Oh right, sorry. Getting confused… :D
Offline
#8 2009-02-11 02:57:34
- juliane
- Member
- Registered: 2009-02-08
- Posts: 33
Re: assign an url to <txp:article_image />
it kinda worked for me. but the link for the image it’s wrong cause its showing my site first, like this: www.mysite.com/www.urltoimage.com
what could be wrong?
Offline
Re: assign an url to <txp:article_image />
Try
<txp:if_custom_field name="img-url"><a href="<txp:custom_field name="img-url" />"><txp:article_image /></a></txp:if_custom_field>
This way nether the a
tag nor the article_image
one will not be parsed unless the custom field contains a value.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: assign an url to <txp:article_image />
Alternatively you can try something like the following which checks if there is an article image too. If there isn’t a generic one is assigned
<txp:if_custom_field name="img-url">
<a href="<txp:custom_field name="img-url" />">
<txp:if_variable name="article_img" value="">
<img src="<txp:site_url />images/generic.jpg" alt="photo" class="yourclass" width="70" height="70"></a>
<txp:else />
<txp:article_image /></a>
</txp:if_custom_field>
Last edited by colak (2009-02-11 06:36:56)
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 2009-02-11 13:42:50
- juliane
- Member
- Registered: 2009-02-08
- Posts: 33
Re: assign an url to <txp:article_image />
it worked now. the thing is you have to type http:// before the www in the img-url custom field. ortherwise it will show your own website first.
thanks guys! :)
Offline
Re: assign an url to <txp:article_image />
juliane wrote:
it worked now. the thing is you have to type http:// before the www in the img-url custom field. ortherwise it will show your own website first.
thanks guys! :)
or put it in the form
<txp:if_custom_field name="img-url">
<a href="http:\\<txp:custom_field name="img-url" />">
<txp:article_image />
</a></txp:if_custom_field>
Last edited by MattD (2009-02-11 17:06:10)
Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker
Offline