Best way to have options pre selected?

Author Message

Gabriel Ambuehl

Saturday 03 May 2003 7:41:08 am

I was wondering how one goes best about adding the selected attribute to individual <option> elements based on the content of a variable.

switch seems not to work, as it will strip away everything outside the {case} {/case} elements and having an entirely different option box for each case of the switch is rather ugly and hard to change when you decide to change some option.

Ideally, I'd want something like
<option {if $myvalue=a>a</option>
<option {if $myvalue=b>b</option>

The eq operator seems of no use either as it will return true, not some arbitrary element of text...

Visit http://triligon.org

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

Main resources:

Total runtime1.0478 sec
Peak memory usage4,096.0000 KB
Database Queries46

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0082 589.1484152.6406
Module start 'layout' 0.00820.0025 741.789139.4766
Module start 'content' 0.01071.0357 781.2656428.4844
Module end 'content' 1.04640.0014 1,209.75008.1406
Script end 1.0478  1,217.8906 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.2982160.0002
Check MTime0.00130.1256160.0001
Mysql Total
Database connection0.00310.300210.0031
Mysqli_queries1.007296.1189460.0219
Looping result0.00060.0525440.0000
Template Total1.013696.720.5068
Template load0.00190.184220.0010
Template processing1.011796.549820.5058
Template load and register function0.00020.016210.0002
states
state_id_array0.00080.077010.0008
state_identifier_array0.00170.163020.0009
Override
Cache load0.00150.145690.0002
Sytem overhead
Fetch class attribute can translate value0.00080.078510.0008
Fetch class attribute name0.00090.088010.0009
XML
Image XML parsing0.00010.010510.0001
class_abstraction
Instantiating content class attribute0.00000.000510.0000
General
dbfile0.00060.0606100.0001
String conversion0.00000.000840.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
1content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.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/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: 6
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs