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)

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 07:12:40
Script start
Timing: Jan 19 2025 07:12:40
Module start 'layout'
Timing: Jan 19 2025 07:12:40
Module start 'content'
Timing: Jan 19 2025 07:12:40
Module end 'content'
Timing: Jan 19 2025 07:12:40
Script end

Main resources:

Total runtime0.0143 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0043 590.2813152.6250
Module start 'layout' 0.00430.0025 742.906339.4453
Module start 'content' 0.00680.0055 782.351693.4297
Module end 'content' 0.01230.0019 875.781338.3047
Script end 0.0143  914.0859 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002215.0923140.0002
Check MTime0.00107.0694140.0001
Mysql Total
Database connection0.00074.690710.0007
Mysqli_queries0.002416.814230.0008
Looping result0.00000.063310.0000
Template Total0.001611.410.0016
Template load0.00085.579210.0008
Template processing0.00085.754210.0008
Override
Cache load0.00064.103910.0006
General
dbfile0.00149.471480.0002
String conversion0.00000.035040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs