Forums / Setup & design / Displaying the contents of a matrix

Displaying the contents of a matrix

Author Message

J Williams

Friday 20 August 2004 11:10:42 am

I have looked throughout these forums but can find little information regarding the use of a matrix datatype. I have created a matrix in one of my classes but cannot work out how to display the contents in table. I have managed to display each row of the matrix using {attribute_view_gui attribute=$node.data_map.matrix_name} but this lacks formatting and the column headers. Can anyone please point me in the right direction.

Many thanks in advance

J Williams

Monday 23 August 2004 7:37:14 am

Maybe no one uses the matrix datatype in a class.

Paul Forsyth

Monday 23 August 2004 7:40:14 am

Have you looked at the ez template file:

design/standard/templates/content/datatype/view/ezmatrix.tpl

paul

J Williams

Monday 23 August 2004 10:06:20 am

thanks for your reply. Maybe some more information might help. I am using EZ Publish 3.41 (svn 7051). However I try and display the contents of the matrix other than attribute_view as above nothing happens. Using the code from the ezmatrix.tpl file still produces a blank, not even the headers.

Alex Jones

Monday 23 August 2004 10:30:31 am

I'm not sure if this will work or not, as the Matrix datatype I am using is a bit old, and modified, but you never know... I have an override template for a Matrix that display product specs. While I don't use a table, it should provide you an idea of hot to accomplish your goals.

{let matrix=$attribute.content}
  {section loop=$matrix.rows.sequential}
    {section show=$:item.columns.1} {* Show the field's value *}
    <div class="Specification">
      <div class="SpecName">
        {$:item.columns.0}
      </div>
      <div class="SpecResult">
        {$:item.columns.1}
      </div>
    </div>
    {/section}
  {/section}
{/let}

I call it from my class override template with:

{attribute_view_gui attribute=$content_version.data_map.item_1_specifications_construction}

Hope this helps,

Alex

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

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

J Williams

Monday 23 August 2004 3:21:18 pm

Hi Alex,

I think my problem is a little bit more fundamental than this. If I don't use any overrides at all and view my matrix in the default template what I see is:-
==================================================================================
Default object view. Click to create a custom template, Node ID: 67, Object ID: 65
Test Matrix

<b>title</b>
Test Matrix

<b>reference</b>
abc

<b>field2</b>
data 1
data 2
data 3
==================================================================================

The first column of data is missing completely. If I create an override using anything other than {attribute_view_gui attribute=$node.data_map.<i>matrix_name</i>} no data is displayed at all. I have tried this on two different installations and the results are the same. My conclusions are that I am probably creating the override incorrectly or overriding the wrong template. I have tried overriding node/view/full with a template matching the class but this gives me a blank. I have tried overriding ezmatrix.tpl but this also gives me a blank although I suspect this only determines the display format of the matrix. I am at a complete loss on this one and any guidance would be greatly appreciated.

steve walker

Tuesday 24 August 2004 12:07:29 am

Have you enabled template debug so you can seed exactly which templates are being used where?

Steve.

http://www.oneworldmarket.co.uk

J Williams

Tuesday 24 August 2004 2:58:56 am

Hi Pete, Alex, Paul,

I hold my hands up, I let frustration get the better of me and let common sense fly out the window. It helps if I override the correct template (/content/datatype/view/ezmatrix.tpl) and then reference the matrix in the full view override. Many thanks for your help guys the matrix is now working correctly and displaying the output in a table formatted exactly as I wanted it.

Paul Forsyth

Tuesday 24 August 2004 5:32:58 am

Thats good news :)

paul

Alex Jones

Tuesday 24 August 2004 7:02:37 am

Great to hear!

Alex

<b>Drop by the eZ Pub: http://ezpub.co.uk/ </b>
[ bald_technologist on the IRC channel: #eZpublish ]

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

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

eZ debug

Timing: Jan 19 2025 11:35:41
Script start
Timing: Jan 19 2025 11:35:41
Module start 'content'
Timing: Jan 19 2025 11:35:41
Module end 'content'
Timing: Jan 19 2025 11:35:41
Script end

Main resources:

Total runtime0.1835 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0080 589.0547180.8281
Module start 'content' 0.00800.0065 769.8828102.0078
Module end 'content' 0.01450.1690 871.8906530.0781
Script end 0.1834  1,401.9688 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00361.9791200.0002
Check MTime0.00150.8025200.0001
Mysql Total
Database connection0.00120.648910.0012
Mysqli_queries0.137975.14531410.0010
Looping result0.00140.76821390.0000
Template Total0.168691.910.1686
Template load0.00090.500310.0009
Template processing0.167791.357510.1677
Override
Cache load0.00060.342710.0006
Sytem overhead
Fetch class attribute can translate value0.00090.502310.0009
XML
Image XML parsing0.00030.150310.0003
General
dbfile0.00261.4235200.0001
String conversion0.00000.005830.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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