Fetch a specific column in a frontpage

Author Message

Jeremy A

Tuesday 17 June 2008 8:05:36 am

Hello,

I have a frontpage composed of 3 columns (left, center, right). I would like to fetch the text from the left column (in order do display it in the header).
I have tried several fetch functions without any success. My frontpage id is 66 and my left column id is 249.

Any help would be very appreciated.
Thanks,
Jeremy

Felix Laate

Tuesday 17 June 2008 11:42:42 pm

Hi Jeremy,

if you display the text in your left column, then you have fetched the node already, and should be able to reuse it anywhere on your page (presuming you haven't undef'ed it).

Could you please give some more info on how the content of your left column is fetched, what kind of datataype it is and so on?

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Jeremy A

Wednesday 18 June 2008 12:27:51 am

Hi,
Thanks for your answer.
Here is the code :
pagelayout.tpl calls frontpage.tpl to display the main area.
In frontpage.tpl we can find :

<div class="left-column-position">
            <div class="left-column">
            <!-- Content: START  -->
                   {attribute_view_gui attribute=$node.object.data_map.left_column}
            <!-- Content: END -->

The last line display the text I put in the left column. But when I put

 {attribute_view_gui attribute=$node.object.data_map.left_column}

in my header area (in pagelayout.tpl), nothing is displayed, maybe because it's not the same file ?

I have found a 'workaround' : I created a content class with just a text block, added it to my content structure, then I fetch it like a simple node. Then the text is well written. In this way it works very well.
But I don't know wich is the best answer, the cleanest method..

Thanks.
<i>sorry for any mistakes, i'm not english</i>

Felix Laate

Wednesday 18 June 2008 1:03:32 am

Hi again,

you can't reach $node from pagelayout (have a look at this old but very usefull page http://ez.no/ezpublish/documentation/customization/custom_design/template_variables_set_by_ezpublish for more info), but if fetch the node there you should be ok.

{def $my_node=fetch( 'content', 'node', hash( 'node_id', 249) )}

{attribute_view_gui attribute=$my_node.object.data_map.left_column}

{undef $my_node}

Hope this helps!

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Jeremy A

Wednesday 18 June 2008 1:27:41 am

Hi,
Thank you, but the code doesn't display anything.
But I will stay with my new content class, I think it's the cleanest way to do that.
Thanks again,
Jeremy

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

Main resources:

Total runtime0.0166 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.0049 589.1719152.6250
Module start 'layout' 0.00490.0026 741.796939.4453
Module start 'content' 0.00750.0068 781.242293.4297
Module end 'content' 0.01430.0022 874.671934.3047
Script end 0.0165  908.9766 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002917.2186140.0002
Check MTime0.00116.7052140.0001
Mysql Total
Database connection0.00063.832610.0006
Mysqli_queries0.002112.502330.0007
Looping result0.00000.072010.0000
Template Total0.001810.710.0018
Template load0.00116.627510.0011
Template processing0.00073.995210.0007
Override
Cache load0.00084.622710.0008
General
dbfile0.001710.278880.0002
String conversion0.00000.034540.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