Forums / Developer / Texttoimage in php mode

Texttoimage in php mode

Author Message

Sébastien Morel

Tuesday 09 October 2007 2:40:27 am

Hi,

I try to find a way to call the equivalent php function of the template operator texttoimage('myclass');

I don't find this in the kernel, or in lib. I haven't searched deeply, i want to know if somebody knows...

Somebody knows ?

Thanks,

--
eZ c'est plus fort que toi !
http://www.ez-france.org
http://blog.plopix.net
@Novactive (http://www.novactive.com)

Sébastien Morel

Tuesday 09 October 2007 9:51:25 am

Hi, I find the way ;)

function imageTitre($titre) {
		 include_once( 'kernel/common/template.php' );
       	 $tpl =& templateInit();  
         $tpl->setVariable( 'title',$titre);
	     $templateResult =& $tpl->fetch( 'extension/xajax_offres/design/standard/templates/t2img.tpl' );
	     return $templateResult;
	}

t2img.tpl :

<!--{$title}-->{$title|texttoimage('oseo_image_titre_content_xajax_titre')}

++
;)

--
eZ c'est plus fort que toi !
http://www.ez-france.org
http://blog.plopix.net
@Novactive (http://www.novactive.com)

Damien Pobel

Tuesday 09 October 2007 10:58:54 am

Hi Sébastien,

your solution is quite elegant :)
When I'm looking for the définition of a template operator, I use this command under Linux :

find -name \*.php -exec grep -il 'texttoimage' {} \;

<i><!--{$title}-->{$title|texttoimage('oseo_image_titre_content_xajax_titre')}</i>
tient OSEO :-)

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish

Sébastien Morel

Tuesday 09 October 2007 2:42:53 pm

Yep,

Before finding an another method (with the template), I have browse the kernel and the lib to find the php code... but no. I don't see how do that.
Even, with your grep, me I use Ctrl+F : find in File :p

I'm very curious to know how use this operator directly in php.

Thanks for the crazy eZ developpers who knows and who could explain that ;)

++

--
eZ c'est plus fort que toi !
http://www.ez-france.org
http://blog.plopix.net
@Novactive (http://www.novactive.com)