• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: CTLModuleMaker - Header Menu & Item List [SOLVED]
PostPosted: Wed Jul 01, 2009 12:03 pm 
Offline
Forum Members
Forum Members

Joined: Sun Mar 25, 2007 7:42 am
Posts: 40
I just can't seem to solve this, what I need is a page (every page) that has the (active) top level displayed as a horizontal menu, with links to lists of the children for the parent selected.

The CSS formatting of the lists is not a problem, but getting the child list is.

{cms_module module="my_menus" what="parent"}
{foreach from=$itemlist item="item"}
  • is_selected}class="active"{/if}>{$item->detaillink}

  • {/foreach}

    "{cms_module module="my_menus" what="parent"}" does print the top level active menus correctly, but when I click on one of the top level menus, instead of getting a list of children for the selected parent, what I get is a another list of the top level parents ?!

    Any help gratefully accepted :-)

    Thanks

    P


    Last edited by crankshaft on Fri Jul 03, 2009 12:54 am, edited 1 time in total.

    Top
     Profile  
     
     Post subject: Re: CTLModuleMaker - Header Menu & Item List
    PostPosted: Thu Jul 02, 2009 11:22 am 
    Offline
    Forum Members
    Forum Members

    Joined: Sun Mar 25, 2007 7:42 am
    Posts: 40
    Bump....

    Can someone help please ??

    I need a template that has a list of top level items, and the same template lists the children of the selected parent.

    The key thing is to always display all the active top level items, and only the children of the top parent selected.

    Thanks

    P


    Top
     Profile  
     
     Post subject: Re: CTLModuleMaker - Header Menu & Item List
    PostPosted: Thu Jul 02, 2009 1:16 pm 
    Offline
    Forum Members
    Forum Members
    User avatar

    Joined: Wed Oct 15, 2008 10:38 am
    Posts: 196
    Hi,
    I take it you first call your module from the page using:
    {cms_module module="my_menus" what="child"} and that the template you've given has been set default template for the child level?
    Technically I don't see what this wouldn't work (though I'll take a look at it), but I believe it would be more simple to call the module twice independently. For example, you could have your page template (roughly) :

    (header stuff)
    {cms_module module="my_menus" what="parent"}
    {content}
    (footer stuff}

    and then call the item list as the content of your page :
    {cms_module module="my_menus" what="child"}
    (without the call to parents in the module template)

    Then, as links default to inline, when you'll click on a parent, the module action will replace the content, so you'll get what you're looking for.

    Pierre-Luc


    Top
     Profile  
     
     Post subject: Re: CTLModuleMaker - Header Menu & Item List
    PostPosted: Thu Jul 02, 2009 1:59 pm 
    Offline
    Forum Members
    Forum Members

    Joined: Sun Mar 25, 2007 7:42 am
    Posts: 40
    Hi;

    Thanks for the suggestions.

    I'd actually tried calling the module twice in the page content, but the problem is, the page where the module is called twice is replaced by the template as soon as a parent is selected, and so it only works for the very first page.

    I have tried lots of things including module queries and passing the output of the parent to a UDT and then trying to display the UDT for the header (parent menus) nut that just crashes the template.

    I've tried calling templates inside templates but that does not work either, I'm stumped.

    Just to summarize, in the same template, I need a list of all of the top level items to be always displayed, and also a list of the children of the selected parent, all in the same template.

    As mentioned, this all needs to be done in the template, as the template over-writes the original page {content} which it was called from, and it looks like a template can only display the parent list or the child list but not both !

    Thanks

    P


    Last edited by crankshaft on Thu Jul 02, 2009 3:28 pm, edited 1 time in total.

    Top
     Profile  
     
     Post subject: Re: CTLModuleMaker - Header Menu & Item List
    PostPosted: Thu Jul 02, 2009 5:00 pm 
    Offline
    Forum Members
    Forum Members
    User avatar

    Joined: Wed Oct 15, 2008 10:38 am
    Posts: 196
    crankshaft wrote:
    I'd actually tried calling the module twice in the page content, but the problem is, the page where the module is called twice is replaced by the template as soon as a parent is selected, and so it only works for the very first page.


    Obviously. That's why I said to place the parent menu in the page template and the item list in the page content.


    Top
     Profile  
     
     Post subject: Re: CTLModuleMaker - Header Menu & Item List [SOLVED]
    PostPosted: Fri Jul 03, 2009 12:53 am 
    Offline
    Forum Members
    Forum Members

    Joined: Sun Mar 25, 2007 7:42 am
    Posts: 40
    Thanks;

    The result is the same, the page content {content} tag is overwritten by the module, so anything which you put in the page content will disappear once one of the module's links are clicked.

    So anyway, I could not find a solution that worked using just the page content and the module, so came up with a solution that works by modifying the main template and adding a bit of javascript /DOM.

    Here's a summary of what I did:

    1) Add a new
    just above the {content} tag:
    Code:
    <h2>{title}</h2>
    <div id="parents" style="display:none;">{cms_module module="my_module" what="menu" listtemplate="my_template"}</div>
    {content}


    2. Create  a new Global Content Block: {global_content name='show_menus'}
    Code:
    {literal}
    <script type="text/JavaScript">document.getElementById('parents').style.display = '';</script>
    {/literal}


    3. In the template that you use for the child list add the global content block:
    Code:
    {global_content name='show_menus'}


    4. In your Page Content which displays the child lists (the initial page which gets over-written) also add the gcb:
    Code:
    {global_content name='show_menus'}


    This works, by hiding the additional div on all other pages except for the ones loaded with the module template and the main page itself where you call the module from.

    I really wanted to do it this way in the main template:
    Code:
    <h2>{title}</h2>
    {if $page == "my_display"}<div><div id="parents">{cms_module module="my_module" what="menu" listtemplate="my_template"}</div></div>{/if}
    {content}


    But that again only works the first time the page is loaded, as the $page variable no longer contains the name of the page alias after a link is clicked, but a number which is generated by the module with the "&cntnt01returnid" GET variable.


    Top
     Profile  
     
     Post subject: Re: CTLModuleMaker - Header Menu & Item List [SOLVED]
    PostPosted: Fri Jul 03, 2009 3:31 am 
    Offline
    Forum Members
    Forum Members
    User avatar

    Joined: Wed Oct 15, 2008 10:38 am
    Posts: 196
    crankshaft wrote:
    The result is the same, the page content {content} tag is overwritten by the module, so anything which you put in the page content will disappear once one of the module's links are clicked.

    Once again, that's why you must put it NOT in the page content, but in the page template.

    If your site is online and if you wish, give me an editor access to your cms and I will do it.


    Top
     Profile  
     
    Display posts from previous:  Sort by  
    Post new topic Reply to topic  [ 7 posts ] 

    All times are UTC


    Who is online

    Users browsing this forum: No registered users


    You cannot post new topics in this forum
    You cannot reply to topics in this forum
    You cannot edit your posts in this forum
    You cannot delete your posts in this forum
    You cannot post attachments in this forum

    Search for:
    Jump to:  
    Arvixe - A CMSMS Partner