Share » Forums » Setup & design » ezwebin:"flat_left.tpl" in...

ezwebin:"flat_left.tpl" in override/templates/full/frontpage

ezwebin:"flat_left.tpl" in override/templates/full/frontpage

Sunday 23 November 2008 6:28:38 am - 4 replies

Author Message

Arnaud Lafon

Monday 24 November 2008 1:33:17 am

Hi,

first, including the menu in the frontpage.tpl is not a good thing. Cuz actually, frontpage.tpl is used as a view template, so it will be processed for each object instantiated on the frontpage class... The left menu must be include in the pagelayout. If you need to custom your homepage, override the pagelayout.tpl and the frontpage.tpl if you want. You should read this document : http://ez.no/doc/extensions/website_interface and at least this part of the documentation http://ez.no/doc/ez_publish/technical_manual/4_0/templates

Then, If your leftmenu template doesn't work, it's certainly because some of the needed variables are set in the pagelayout.tpl and will not be available in the content view template

Looking for information about SQLI ?
Looking for a new job in Paris ?
Please contact me at alafon [at] sqli [dot] com

Maximilien LELEU

Monday 24 November 2008 2:20:28 am

Hi Arnaud,

Thank you for answering. I understood all that you said but my problem is still the following:

I want a 3 column homepage layout (using frontpage.tpl) but I would like to have the content of the first column (left) under the sidemenu.
I've already tried to keep the left menu in pagelayout.tpl and to use css stylesheets in order to style my homepage this way... but this is simply not possible to achieve...
I've read the Customization guide you suggested carefully and as you can see on the layout structure, the "sidemenu-position" div is located before the "main-position" div . As a result I can't "extract" the left column from the "main-position" div and display it under sidemenu.

I tried another solution: to add a toolbar position under the siedmenu and modify the folder class in order to be able to add content on the right.
Using this solution I can have my sidemenu with some content below, the main content and content on the right. The problem is: The content I can add using the toolbar is rather limited and cannot be different from one page to another. I would prefer to have the frontpage template applied to be able to add objects in both left and right columns

I think I'm in a deadlock...What would you recommend?

Thanks a lot

Arnaud Lafon

Monday 24 November 2008 4:28:19 am

What about including a custom template just after the flat_left include :

{include uri="design:menu/left_menu.tpl"}
{if $some_reason}
{include uri="design:menu/push_frontpagecontent.tpl"}
{/if}

In the new template, you'll be able to use the $module_result variable. Maybe you could fetch the current node by using

{def $current_node = fetch( 'content', 'node', hash( 'node_id', $module_result.node_id ))}
....
....

Actually, you should fetch the $current_node at the top of your pagelayout... Then you'll be able to check anything you want. For exemple $some_reason could be equal to $current_node.class_identifier|eq('frontpage') (ie: you include the push_frontpagecontent.tpl only when you are displaying a frontpage object.

Another thing. When you use the $module_result variable, keep in mind that all the attribute are not always set. For exemple, *.node_id is only defined when the content module is used.
What I often defined at the beginning of my pagelayout is :

{def $current_node_id = first_set( $module_result.node_id, 0 )
    $current_node = cond( $current_node_id|ne(0), fetch( 'content', 'node', hash( 'node_id', $current_node_id )), false )}

Then, you'll have to put some cache-block with the good keys, etc...

Hope this helps

Looking for information about SQLI ?
Looking for a new job in Paris ?
Please contact me at alafon [at] sqli [dot] com

Richard Lundberg

Friday 05 December 2008 4:28:57 pm

Hi,

You are right, it is not possible to achieve a left menu by changing the pagelayout.tpl as this template will then try to render the left menu before and above the billboard.

One other solution I implemented is to have 2 frontpage objects, one for the main page, and one for sub pages. (similar to article main page and article subpage). I then created a simple menu, (similar to the multipage article menu)

            {* Frontpage index *}
            {def $frontpage_subpages=fetch( content, list, hash( parent_node_id, $used_node.node_id,
                                                              sort_by, $used_node.sort_array ) )}
{if $frontpage_subpages|count}
        
            <div class="border-box">
            <div class="border-tl"><div class="border-tr"><div class="border-tc"></div></div></div>
            <div class="border-ml"><div class="border-mr"><div class="border-mc float-break">

        <h4><a href={$used_node.url_alias|ezurl}>
                 {if $used_node.object.data_map.index_title.has_content}
                    {attribute_view_gui attribute=$used_node.object.data_map.index_title}
                {else}
                    {$used_node.name|wash}
                {/if}
                </a></h4>

            <div class="sidemenu">
            <ul class="menu-list">
            {foreach $frontpage_subpages as $frontpage_subpage}
                {if eq( $node.node_id, $frontpage_subpage.node_id )}
                    <li><a class="selected" href={$frontpage_subpage.url_alias|ezurl}>
                    {if $frontpage_subpage.object.data_map.index_title.has_content}
                        {attribute_view_gui attribute=$frontpage_subpage.object.data_map.index_title}
                    {else}
                        {$frontpage_subpage.name|wash}
                    {/if}
                    </a></li>
                {else}
                    <li><a href={$frontpage_subpage.url_alias|ezurl}>
                    {if $frontpage_subpage.object.data_map.index_title.has_content}
                        {attribute_view_gui attribute=$frontpage_subpage.object.data_map.index_title}
                    {else}
                        {$frontpage_subpage.name|wash}
                    {/if}
                    </a></li>
                {/if}
            {/foreach}
            </ul>
            </div>
            </div></div></div>
            <div class="border-bl"><div class="border-br"><div class="border-bc"></div></div></div>
            </div>
       
{/if}

Then in the left column I call this menu accordingly.
Mainpage

<div class="columns-frontpage float-break">
        <div class="left-column-position">
            <div class="left-column">
                  <div id="sidemenu">
            <!-- Content: START -->
          {include uri='design:menu/left_frontpage.tpl' used_node=$node}
           <!-- Content: END -->
        	     </div>
            </div>
        </div>

Sub page

    <div class="columns-frontpage float-break">
        <div class="left-column-position">
            <div class="left-column">
                  <div id="sidemenu">
            <!-- Content: START -->
          {include uri='design:menu/left_frontpage.tpl' used_node=$node.parent}
           <!-- Content: END -->
        	     </div>
            </div>
        </div>

Hope this helps............

www.peakm3.com

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu