Page 1 of 1

I still don't get what the menu templates are? (confused in completing my design

Posted: Wed Sep 19, 2007 4:12 am
by latedude32
Hi. I found CMS, and found that since it was so easy, I would convert my site to it from just pure HTML/PHP. So I copy pasted the different parts of it into a new template, copy and pasted the stylesheet, attached the stylesheet to it, and made it default template. Now the page is just showing really funky...

But I also realized I don't have a menu template made up. Is that just the CSS for the menu?

Thanks,
Latedude32


BTW: I'm running the lastest stable versions of PHP, CMS, etc. (I'm using BlueHost)

Also, I don't think I fully understand the template system (first time using a CMS), so I'll post my template...


{sitename} - {title}
{metadata}
{stylesheet}






 
  {menu}





  {sitename}





  {title}
  {content}





Re: I still don't get what the menu templates are? (confused in completing my de

Posted: Wed Sep 19, 2007 8:02 am
by KO
menu templates are templates that your {menu} call in your page template uses. You can tell what template you want to use by {menu template="yourtemplate"}. If you add tpl ending to yourtemplate.tpl menu manager looks for file othervice it looks database for it.

Menu manager uses always some menu template (I believe default is simple_navigation.tpl) which has id's and classes that you need to match in your stylesheet to look right. Those stylesheets are attached in normal page templates. So maybe your stylesheet (or menu template) needs changing of id or class names both to match.

br, K

Re: I still don't get what the menu templates are? (confused in completing my de

Posted: Wed Sep 19, 2007 8:45 pm
by latedude32
I'm sorry but I still don't get what I write in it... If I have all the data in there, then what's the point of a menu ? Am I simply taking the CSS out of the stylesheet and adding it to the template?

Re: I still don't get what the menu templates are? (confused in completing my de

Posted: Thu Sep 20, 2007 7:16 am
by KO
- Css is connected to page template always. You write your styles and connect them there.
- Page template has {menu} call that uses menu template. What you have included is page template. Look for the source of your page to see how code comes out.
- around menu is most likely used to give that block name so only menu area is styled. It can be in menu template also for sure. But if same menu template is used in different places of page more than once it might be easier to have it in page template. it can also be removed if your design does not need.

hope this helps,
K

Re: I still don't get what the menu templates are? (confused in completing my de

Posted: Thu Sep 20, 2007 6:44 pm
by Ned Nowotny
A menu template is like a page template.  It generates the HTML (including "id" and "class" attributes used by CSS) necessary to present the menu data.  The CSS associated with a page template that includes a "menu" Smarty tag (possibly using an explicit menu template specified with the optional "template" parameter) is used to style the menu.

Generally, most menu templates take a list of "nodes" containing the menu data and format the desired data as an HTML list.  Creating your own menu template, you could choose to use an ordered list ("") or an "unordered" (""--i.e. "bullet" list) or a definition list ("dl") or an HTML table or a paragraph containing menu entries separated by line breaks ("
") or...  Basically, the menu template enables you to format the menu data as necessary to meet your formatting and presentation (by adding "id" and "class" attributes) needs.

As an example of why you might write your own menu template, you might want to select a subset for presentation of the nodes selected by a given set of "menu" Smarty tag parameters.  In my case, I have a "page" that exists outside of the rest of my menu hierarchy and that is excluded from the menu system that is implemented to return a formatted menu suitable for use in legacy static HTML pages that have not yet been manually imported into CMSMS.  These pages use a server-side include to access the CMSMS page I created.

Because the "page" I created is outside the sub-tree of the menu hierarchy that I use in the desired menu, I cannot use the "start_level" parameter.  Using a combination of the "start_page" or "start_element" parameters with the "show_root_siblings" parameter resulted in more than twice as many SQL queries and, consequently, very poor performance when compared to just using the "start_page" or "start_element" parameter to select the parent node of all of the child nodes I actually wanted to list in my menu.  (This is one of several significant performance problems with the current Menu  Manager module.)  My solution for the time being is to use a custom menu template that simply skips the first (i.e. "root" or ultimate parent node of all of the selected nodes) when formatting up my HTML list.

The relevant portion of the menu template looks like:

Code: Select all

{foreach from=$nodelist item=node}
{if $node->index > 0}
...
{/if}
{/foreach}
(I would prefer to pass a node list omitting the first element to the "foreach" tag, but that is not trivially accomplished using Smarty.  It requires an escape to full PHP as far as I can tell.)

Because the same menus may be used in a variety of pages associated with different page templates, menu templates are the mechanism for creating reusable menus for use in multiple page templates.  While the included menu templates may meet your needs, being able to create your own menu templates can be very useful when they don't.