Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-11-15 15:17:38

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

if_article_image tag

Although this problem is soved, I regularly run into problems that an <txp:if_article_image> tag would wipe out at a stroke.

Does anyone know if there are any plans for one?

Offline

#2 2006-11-15 16:22:20

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

Re: if_article_image tag

There is the tcm_if_article_image plugin.


Shoving is the answer – pusher robot

Offline

#3 2006-11-15 18:39:08

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: if_article_image tag

ace – thanks :)

Offline

#4 2006-11-28 20:17:35

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,634
GitHub Twitter

Re: if_article_image tag

Another method. I use this on a site to test if the article image exist :

<txp:php>global $thisarticle; $site = 'http://'.$GLOBALS['siteurl']; $pic = $thisarticle['article_image']; $title = $thisarticle['title']; $authorname = custom_field (array('name' => 'Author',)); echo( (empty($thisarticle['article_image']) ? "<img src=\"".$site."/images/blank.jpg\" alt=\"Generic Cover Book\" title=\"\" />" : "<a href=\"".$site."/images/".$pic.".jpg\" title=\"«".$title."» by ".$authorname."\" class=\"thickbox\"><img src=\"".$site."/images/".$pic."t.jpg\" alt=\"Cover of the Book\" title=\"Display the cover book\" /></a>") );</txp:php>

…and in French :

<txp:php>global $thisarticle; $site = 'http://'.$GLOBALS['siteurl']; $pic = $thisarticle['article_image']; $titre = $thisarticle['title']; $auteur = custom_field (array('name' => 'Auteur',)); echo( (empty($thisarticle['article_image']) ? "<img src=\"".$site."/images/blank.jpg\" alt=\"Couverture du livre non disponible\" title=\"\" />" : "<a href=\"".$site."/images/".$pic.".jpg\" title=\"«".$titre."» de ".$auteur."\" class=\"thickbox\"><img src=\"".$site."/images/".$pic."t.jpg\" alt=\"Couverture du livre\" title=\"Afficher la couverture\" /></a>") );</txp:php>

In this sample code, if article image don’t exist, I replace it with a generic one.
Hope that’s help you.

Last edited by Pat64 (2006-11-28 20:22:46)


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#5 2007-06-14 10:49:47

FireFusion
Member
Registered: 2005-05-10
Posts: 698

Re: if_article_image tag

+ 1 for this request to be built in to the core

Offline

Board footer

Powered by FluxBB