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>

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

Main resources:

Total runtime0.0133 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.0039 589.2734152.6406
Module start 'layout' 0.00390.0026 741.914139.4609
Module start 'content' 0.00650.0053 781.375097.4453
Module end 'content' 0.01190.0015 878.820342.3047
Script end 0.0133  921.1250 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.001914.3615140.0001
Check MTime0.00096.7208140.0001
Mysql Total
Database connection0.00064.315110.0006
Mysqli_queries0.002417.724630.0008
Looping result0.00000.098210.0000
Template Total0.00128.910.0012
Template load0.00064.666910.0006
Template processing0.00064.165010.0006
Override
Cache load0.00043.175610.0004
General
dbfile0.001712.918480.0002
String conversion0.00000.050040.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