Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2012-11-13 16:43:48
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,305
Insert photo's credits and website
(Wow, slightly chaotic order now in this topic: it’s been a cross-posting from the spanish section I wanted to clean up, and now my answer is first in this topic, before robhert’s question. That’s a rare moderation gem ;)
There are two slashes too much in:
<txp:if_custom_field name="Website" />
[...]
<txp:if_custom_field name="Website" />
Last edited by uli (2012-11-13 17:44:40)
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: Insert photo's credits and website
Hi!
I want to show photo’s credits and website address below an image. Somethink like this:
Photo Image
Title of photo / Credits: Name (the name is a link to its addess url)
I have used for this custom field, but I don’t know what it wrong, check it out:
<div class="img-cap">
<txp:image_info type="caption" />
<txp:if_custom_field name="Fuente">
<span class="img-cap-fuente">Fuente: </span>
<txp:if_custom_field name="Website" />
<a href='<txp:custom_field name="Website" />'>
</txp:if_custom_field>
<txp:custom_field name="Fuente" />
<txp:if_custom_field name="Website" />
</a>
</txp:if_custom_field>
</txp:if_custom_field>
</div>
Any ideas?
Thank you in advance
Offline
Re: Insert photo's credits and website
Hi Uli! You are fast!
It worked! Thankyou very much! Sorry for disturb you, but could you tell me if there is a way to make this simpler?
<txp:if_article_image>
<txp:article_image thumbnail="0" />
<txp:images>
<div class="img-cap">
<txp:image_info type="caption" />
<txp:if_custom_field name="Fuente">
<span class="img-cap-fuente">Fuente: </span>
<txp:if_custom_field name="Website">
<a href='<txp:custom_field name="Website" />'>
</txp:if_custom_field>
<txp:custom_field name="Fuente" />
<txp:if_custom_field name="Website">
</a>
</txp:if_custom_field>
</txp:if_custom_field>
</div>
</txp:images>
</txp:if_article_image>
Thank you!!!
Offline
#4 2012-11-13 17:38:15
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,305
Re: Insert photo's credits and website
If I understand right how you set up the logic against your custom_fields contents, could this part of your code with two queries …
<txp:if_custom_field name="Website">
<a href='<txp:custom_field name="Website" />'>
</txp:if_custom_field>
<txp:custom_field name="Fuente" />
<txp:if_custom_field name="Website">
</a>
</txp:if_custom_field>
… be abbreviated to one query with an else switch:
<txp:if_custom_field name="Website">
<a href='<txp:custom_field name="Website" />'><txp:custom_field name="Fuente" /></a>
<txp:else />
</txp:if_custom_field>
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#5 2012-11-13 17:49:28
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,305
Re: Insert photo's credits and website
robhert wrote:
Hi Uli! You are fast!
… yes, in case you mean that I answered before you asked (see my annotation in the first post)
=D)
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: Insert photo's credits and website
Nice! Yeah Uli, you give the answer before I asked. And let see, I end up with this:
<txp:if_article_image>
<txp:article_image thumbnail="0" />
<txp:images>
<div class="img-cap">
<txp:image_info type="caption" />
<txp:if_custom_field name="Website">
<span class="img-cap-fuente">Fuente: </span><a href='<txp:custom_field name="Website" />'><txp:custom_field name="Fuente" /></a>
<txp:else />
<txp:if_custom_field name="Fuente">
<span class="img-cap-fuente">Fuente: </span><txp:custom_field name="Fuente" />
<txp:else />
</txp:if_custom_field>
</txp:if_custom_field>
</div>
</txp:images>
</txp:if_article_image>
Thank you man!
Offline
#7 2012-11-13 18:19:05
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,305
Re: Insert photo's credits and website
That’s what I meant when I said “If I understand right how you set up the logic against your custom_fields contents”.
Mine would look different, I’d put it like this:
<txp:if_article_image>
<txp:article_image thumbnail="0" />
<txp:images>
<div class="img-cap">
<txp:image_info type="caption" />
<txp:if_custom_field name="Fuente">
<span class="img-cap-fuente">Fuente: </span>
<txp:if_custom_field name="Website">
<a href='<txp:custom_field name="Website" />'><txp:custom_field name="Fuente" /></a>
<txp:else />
</txp:if_custom_field>
</txp:if_custom_field>
</div>
</txp:images>
</txp:if_article_image>
Last edited by uli (2012-11-13 18:19:23)
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: Insert photo's credits and website
Thank you! In fact there is just one line to add, in case the “fuente” has no website.
<txp:if_article_image>
<txp:article_image thumbnail="0" />
<txp:images>
<div class="img-cap">
<txp:image_info type="caption" />
<txp:if_custom_field name="Fuente">
<span class="img-cap-fuente">Fuente: </span>
<txp:if_custom_field name="Website">
<a href='<txp:custom_field name="Website" />'><txp:custom_field name="Fuente" /></a>
<txp:else />
<txp:custom_field name="Fuente" />
</txp:if_custom_field>
</txp:if_custom_field>
</div>
</txp:images>
</txp:if_article_image>
:)
Offline
Pages: 1