Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Get the URL of article_image (without a plugin)
Hi guys,
How can I do this? upm_image isn’t working for me in 4.4.1.
Is there something similar to this:
<txp:php>echo htmlspecialchars($GLOBALS['thisarticle']['article_image']);</txp:php>
I tried using article_image_url (worth a pop), but to no avail.
Offline
#2 2012-01-31 12:16:38
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,315
Re: Get the URL of article_image (without a plugin)
Core code:
<txp:images>
<txp:image_url />
</txp:images>
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: Get the URL of article_image (without a plugin)
If I use that exact code within an article, will it know I mean the article_image?
Offline
Re: Get the URL of article_image (without a plugin)
rossharvey wrote:
If I use that exact code within an article, will it know I mean the article_image?
Yes, if you have one set (the default auto_detect
is to check article image first). If there’s a chance you’ll leave article image empty, beware that code will display all your images. To defend against that, wrap Uli’s code with <txp:if_article_image>
.
Last edited by Bloke (2012-01-31 12:25:07)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Get the URL of article_image (without a plugin)
Works perfectly – thanks very much guys!
Offline