Can i write a PHP code in Template

Author Message

Amer Azzaz

Tuesday 06 December 2005 5:47:48 am

Hi to All
I want to know if I can to write a php code in template as it is.
LIKE
{literal}
<?php
print ('Hello World');
?>
{/literal}

Ɓukasz Serwatka

Tuesday 06 December 2005 5:55:46 am

This will not work, and this is not a way how to use "View". If want to execute php script or you need result from script in templates, write custom module or template operator. Good tutorial with examples you can find here.

http://ez.no/products/ez_publish_cms/documentation/development/extensions/building_an_ez_publish_module

http://ez.no/products/ez_publish_cms/documentation/development/extensions/template_operator

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

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 31 2025 06:21:38
Script start
Timing: Jan 31 2025 06:21:38
Module start 'layout'
Timing: Jan 31 2025 06:21:38
Module start 'content'
Timing: Jan 31 2025 06:21:38
Module end 'content'
Timing: Jan 31 2025 06:21:38
Script end

Main resources:

Total runtime0.0165 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.0047 588.1328151.2109
Module start 'layout' 0.00470.0030 739.343836.6484
Module start 'content' 0.00780.0069 775.992290.1250
Module end 'content' 0.01470.0017 866.117229.9922
Script end 0.0164  896.1094 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002514.8943140.0002
Check MTime0.00116.7190140.0001
Mysql Total
Database connection0.00105.822110.0010
Mysqli_queries0.002817.140230.0009
Looping result0.00000.255010.0000
Template Total0.00127.610.0012
Template load0.00095.445410.0009
Template processing0.00032.077910.0003
Override
Cache load0.00063.647110.0006
General
dbfile0.00127.508780.0002
String conversion0.00000.030440.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