is there a possibily of inserting php code in tpl

Author Message

M Farhan

Wednesday 11 June 2003 11:52:55 pm

Hello Everyone,

I need to place in some logic (like if then else) in my tpl code, is there a possibility of doing such a thing??

Thanks in advance

MF

Paul Forsyth

Thursday 12 June 2003 12:13:03 am

You can build a if-then-else with template functions:

{section show=eq($val, 1)}
do something
{section-else}
do something else
{/section}

if you want to test further you can either use a switch statement or embed further sections:

{section show=eq($val, 1)}
do something
{section-else}

{section show=eq($val, 2)}
do more
{section-else}
do even more
{/section}

{/section}

you dont need to resort to php for just this type of logic.

paul

Esben Maaløe

Sunday 22 June 2003 7:28:03 am

> you dont need to resort to php for just this type of logic

Hehehe - I really wish you COULD 'resort' to php :)

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 18 2025 15:15:19
Script start
Timing: Jan 18 2025 15:15:19
Module start 'layout'
Timing: Jan 18 2025 15:15:19
Module start 'content'
Timing: Jan 18 2025 15:15:20
Module end 'content'
Timing: Jan 18 2025 15:15:20
Script end

Main resources:

Total runtime0.7330 sec
Peak memory usage4,096.0000 KB
Database Queries59

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0047 589.1641152.6406
Module start 'layout' 0.00470.0026 741.804739.4922
Module start 'content' 0.00720.7243 781.2969502.8203
Module end 'content' 0.73150.0014 1,284.11728.1250
Script end 0.7329  1,292.2422 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.4220160.0002
Check MTime0.00130.1799160.0001
Mysql Total
Database connection0.00070.094910.0007
Mysqli_queries0.688493.9163590.0117
Looping result0.00060.0841570.0000
Template Total0.704596.120.3522
Template load0.00190.259020.0009
Template processing0.702695.854820.3513
Template load and register function0.00040.047910.0004
states
state_id_array0.00110.144210.0011
state_identifier_array0.00100.136020.0005
Override
Cache load0.00160.2208290.0001
Sytem overhead
Fetch class attribute can translate value0.00050.073330.0002
Fetch class attribute name0.00110.145730.0004
XML
Image XML parsing0.00030.046130.0001
class_abstraction
Instantiating content class attribute0.00000.001130.0000
General
dbfile0.00070.0918100.0001
String conversion0.00000.001040.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
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 14
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs