Forums / General / Can i write a PHP code in Template

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

eZ debug

Timing: Jan 18 2025 19:32:44
Script start
Timing: Jan 18 2025 19:32:44
Module start 'content'
Timing: Jan 18 2025 19:32:45
Module end 'content'
Timing: Jan 18 2025 19:32:45
Script end

Main resources:

Total runtime0.7704 sec
Peak memory usage4,096.0000 KB
Database Queries55

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0056 588.8281180.8359
Module start 'content' 0.00560.7595 769.6641529.1953
Module end 'content' 0.76520.0051 1,298.859442.1016
Script end 0.7703  1,340.9609 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.3941140.0002
Check MTime0.00140.1792140.0001
Mysql Total
Database connection0.00050.063210.0005
Mysqli_queries0.730794.8458550.0133
Looping result0.00050.0628530.0000
Template Total0.739896.020.3699
Template load0.00250.321520.0012
Template processing0.737395.703320.3686
Template load and register function0.00020.026210.0002
states
state_id_array0.00110.147310.0011
state_identifier_array0.00140.185520.0007
Override
Cache load0.00180.2398160.0001
Sytem overhead
Fetch class attribute can translate value0.00170.225520.0009
Fetch class attribute name0.00120.149930.0004
XML
Image XML parsing0.00070.089620.0003
class_abstraction
Instantiating content class attribute0.00000.000830.0000
General
dbfile0.00130.1634200.0001
String conversion0.00010.006530.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 8
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs