classification for <tr>

Author Message

Antoine W.

Friday 01 July 2005 6:00:37 am

Is it possible to use classification for <tr> ?
In example :

<table>
<tr class='normal'><td>blah</td></tr>
<tr class='alternate'><td>blah</td></tr>
</table>

Thanks

Antoine W.

Tuesday 05 July 2005 2:30:24 am

Sorry to insist, but I really need to know if classification for table rows is allowed or not.
When I try to set a "class" attribute for <tr>, it's not accepted.

So how should I proceed to build a beautiful table with an alternate background color for rows ? Should I set classification for each cell of the row ?

Thanks !

Peter Putzer

Tuesday 05 July 2005 3:40:54 am

Strangely enough, <tr> doesn't support a classification in eZ publish XML.

I've got no idea why and at first I tried to hack the kernel to get those alternative row colors. But this proved to be more difficult than expected and there was a much easier way:

{let classification=""}
{section show=$row_count|ne(0)}
	{section show=$row_count|mod(2)|eq(1)}
		{set classification="bgdark"}
	{section-else}
		{set classification="bglight"}
	{/section}
{/section}
<tr {section show=ne($classification,'')} class="{$classification}"{/section}>
{$content}
</tr>
{/let}

On the negative side, you don't have control over the shading. On the plus side, it happens all automatically and the XML code is much shorter (which is a gain especially for long tables).

Accessible website starting from eZ publish 3.0 (currently: 4.1.0): http://pluspunkt.at

Antoine W.

Wednesday 06 July 2005 5:35:15 am

Thanks for your solution, Peter !

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

Main resources:

Total runtime0.7204 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0045 589.1484152.6250
Module start 'layout' 0.00450.0025 741.773439.4453
Module start 'content' 0.00700.7116 781.2188540.9844
Module end 'content' 0.71860.0017 1,322.203112.4844
Script end 0.7204  1,334.6875 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.4356160.0002
Check MTime0.00130.1818160.0001
Mysql Total
Database connection0.00080.106010.0008
Mysqli_queries0.673493.4809600.0112
Looping result0.00060.0774580.0000
Template Total0.695396.520.3476
Template load0.00210.285320.0010
Template processing0.693296.224420.3466
Template load and register function0.00030.037110.0003
states
state_id_array0.00060.084010.0006
state_identifier_array0.00060.086220.0003
Override
Cache load0.00170.2414200.0001
Sytem overhead
Fetch class attribute can translate value0.00060.082120.0003
Fetch class attribute name0.00140.195250.0003
XML
Image XML parsing0.00210.288720.0010
class_abstraction
Instantiating content class attribute0.00000.001550.0000
General
dbfile0.00210.2876160.0001
String conversion0.00000.001140.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
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 17
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs