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.