Different image as top

Author Message

Siw Helen Thorslund

Monday 18 October 2004 6:50:00 am

I'm trying to setp a switch between the image shown based on the $module_result.path[1].node_id.

I set it up like this:


{ if($module_result.path[1].node_id == "111") }

   image 1

{ else } 

   image 2

But this is not working...

Do any of you have a suggestion for me?

Thanx..

www.VZT.no ( http://www.VZT.no )
VZT References ( http://http://vzt.no/index.php/vzt_eng/referanser )
VZT Extensions ( http://vzt.no/index.php/vzt_eng/extensions )
www.MediaBase.no ( http://www.MediaBase.no )

Tobias Persson

Monday 18 October 2004 7:54:25 am

There are no 'if' in the template language. Use section and show instead.

{section show=$module_result.path[1].node_id|eq(111)}
   image 1

{section-else} 

   image 2

{/section}

Marco Zinn

Monday 18 October 2004 12:57:38 pm

Tobias is right. There is no "if" ("There is no spoon")
If you want to switch more than two images, you may want to have a look at the swich-case constructor.
We used this in a very similar case, but i don't have access to the template code at the moment.
Don't forget the fallback/default case, if you use "switch".

Marco
http://www.hyperroad-design.com

Vjeran Vlahovic

Tuesday 26 October 2004 11:07:37 am

I did it this way:

<div id="page-header2" {switch name=kategorija match=$module_result.path[1].node_id}
{case match='101'}
style="background: transparent url(/design/testing/images/background-header2.jpg) no-repeat;"
{/case}
{case match='108'}
style="background: transparent url(/design/testing/images/background-header6.jpg) no-repeat;"
{/case}
{case match='103'}
style="background: transparent url(/design/testing/images/header4.jpg) no-repeat;"
{/case}
{case}
style="background: transparent url(/design/testing/images/header5.jpg) no-repeat;"
{/case}
{/switch}>

http://www.netgen.hr/eng

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

Main resources:

Total runtime0.0230 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.0048 590.2813152.6250
Module start 'layout' 0.00480.0027 742.906339.4453
Module start 'content' 0.00760.0135 782.351693.4297
Module end 'content' 0.02100.0019 875.781334.3047
Script end 0.0229  910.0859 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002611.1628140.0002
Check MTime0.00114.8305140.0001
Mysql Total
Database connection0.00062.661910.0006
Mysqli_queries0.00219.299630.0007
Looping result0.00000.057110.0000
Template Total0.00146.210.0014
Template load0.00073.049310.0007
Template processing0.00073.167710.0007
Override
Cache load0.00052.169610.0005
General
dbfile0.008135.259280.0010
String conversion0.00000.039540.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