How to hide the empty fields in matrix datatype ?

Author Message

Selmah Maxim

Thursday 24 July 2003 1:50:51 am

Any know how can I do this ?

I had add some bgcolor for matrix view template so the empty fields is colored now, I need to hide them , any way ?!

Selmah Maxim

Sunday 27 July 2003 3:18:16 am

?!

Selmah Maxim

Monday 28 July 2003 8:26:00 am

no one knows ?

Alex Jones

Tuesday 05 August 2003 8:59:49 am

Selmah, I finally hit the point where I have to answer this question myself. While my solution is somewhat customized, it may help you develop what you need. The matrix fields that I am trying to hide exist in a two column table that will have a specific override template for that class.

To determine whether or not to show something I am using:

{section show=$Rows:item.columns.1} {* Show the field's value *}
{$Rows:Columns:item}
{section-else} {* Display if field is empty - leave blank to display nothing *}

{/section}

Hope this helps!

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Selmah Maxim

Tuesday 05 August 2003 9:20:35 am

thx .. but this doesn`t help :(

I need to get the rows numbers ... no way what i found, but the strange I can get from matrix.tpl in another template i cann`t !!

How to get the rows number in matrix ?!?!?

Selmah Maxim

Tuesday 05 August 2003 9:28:56 am

I think I found it ..

{let
RowsNumber=count($content_version.data_map.mydata.content.rows.sequential)}
{section show=$RowsNumber|gt(0)} {*show matrix if rows > 0*}
cc
cc
{/section}
{/let}

Alex Jones

Tuesday 05 August 2003 9:30:20 am

Well, as Paul F. would ask, have you tried looking at the attributes for the row? Try something like
{$Rows:item|attribute(show)}

after

{section name=Columns loop=$Rows:item.columns}

to see what is available. I would bet you could use something along the lines of $Rows:item.rows or perhaps just grab the identifier by using $Rows:item.identifier which would output something along the lines of row_2. Please note that the variable names may need to be changed for your code, but that is where viewing the attributes comes in handy. :)

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Alex Jones

Tuesday 05 August 2003 9:50:10 am

Great to hear! I guess I misunderstood what you were trying to do.

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

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 31 2025 04:14:22
Script start
Timing: Jan 31 2025 04:14:22
Module start 'layout'
Timing: Jan 31 2025 04:14:22
Module start 'content'
Timing: Jan 31 2025 04:14:22
Module end 'content'
Timing: Jan 31 2025 04:14:22
Script end

Main resources:

Total runtime0.0210 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.0062 588.2656151.2266
Module start 'layout' 0.00620.0030 739.492236.6953
Module start 'content' 0.00930.0101 776.187598.1875
Module end 'content' 0.01940.0016 874.375037.9922
Script end 0.0210  912.3672 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002712.9862140.0002
Check MTime0.00115.4664140.0001
Mysql Total
Database connection0.00083.905910.0008
Mysqli_queries0.002712.662630.0009
Looping result0.00000.077210.0000
Template Total0.00125.510.0012
Template load0.00094.196610.0009
Template processing0.00031.266410.0003
Override
Cache load0.00062.991610.0006
General
dbfile0.003717.394180.0005
String conversion0.00000.046640.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