Menu adaptation from javascript - help please

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
dirtywhitellama

Menu adaptation from javascript - help please

Post by dirtywhitellama »

Last time I was trying to fix up our website, I found a really nice little menu script or two, which I never quite got working right to fully implement on the page.  However I really like the menu's behavior and I am wondering if it can be directly adapted to work with CMSMS or if CMSMS doesn't know how to work with a menu contained in a javascript, in which case I'd appreciate suggestions on how to fabricate a similar menu.

Also is CMSMS able to handle 2 menus on screen at once?  I mean for example, could I have it display top level and whatever parents of the current page on the left side  and then siblings on the right side? If so how would I go about making that happen?  Self hiding menus preferred :)


Edit: whoops, I forgot to link my files.  The files I have been using are here:  http://www.hisbodylife.com/newtest/    Click the home.html to see the scripts in action.  only a couple of the links in the left menu work, and I never got any links into the right menu at all, but you can see the idea.
cyberman

Re: Menu adaptation from javascript - help please

Post by cyberman »

dirtywhitellama wrote: However I really like the menu's behavior and I am wondering if it can be directly adapted to work with CMSMS or if CMSMS doesn't know how to work with a menu contained in a javascript, in which case I'd appreciate suggestions on how to fabricate a similar menu.
Please have a look at pimenu on CMSms Forge - with it you can adapt every existing menu system for CMSms ...
Also is CMSMS able to handle 2 menus on screen at once?
Why not  :) ?

You must only set the right parameters - please look at the help for your prefered menu.
dirtywhitellama

Re: Menu adaptation from javascript - help please

Post by dirtywhitellama »

Thanks for the tip, I will check that out and let you know how it works for me.

:)
dirtywhitellama

Re: Menu adaptation from javascript - help please

Post by dirtywhitellama »

I can't figure out how to get this installed.  Does it install like a module and if so where do I need to put it on my server?  otherwise how do I put it in?
cyberman

Re: Menu adaptation from javascript - help please

Post by cyberman »

Pimenu is only a plugin - you must upload it to plugin directory. The templates must copied to tmp/templates directory. Then you can call pimenu like all other CMSms menus. Look at the help.

If you want to integrate a non CMSms menu system like yours, you must write your own template. Please look here for an english howto.
dirtywhitellama

Re: Menu adaptation from javascript - help please

Post by dirtywhitellama »

The how to is not extremely useful but I finally figured out last night (before you posted) how to put it into my webpage. (I had missed the plugins directory entirely.)  Now I have been experimenting with trying to convert my menu into the pimenu format which I thought I could manage to do, but it isn't working.  (also, I have a few questions, since I don't understand some of the tag explanations, and also there is no list of values for tags either)

I'm pretty sure that this is the relevant code from my original menu system:

Code: Select all

// ssmItems[...]=[name, link, target, colspan, endrow?] - leave 'link' and 'target' blank to make a header
ssmItems[0]=["Menu"] //create header
ssmItems[1]=["Home", "index.html", ""]
ssmItems[2]=["History", "history.html",""]
ssmItems[3]=["Archives", "Chats/Chats.html", ""]
ssmItems[4]=["Photos", "individual/index.html", "_new"]
ssmItems[5]=["Links", "links.html", ""]
ssmItems[6]=["Guestbook", "Guestbook.html", ""]

ssmItems[7]=["Search", "cgi-bin/search.cgi", "", 1, "no"] //create two column row
ssmItems[8]=["Contact", "Contact/contact.html", "",1]

buildMenu();

This is what I did to try to make it work with CMSMS and pimenu:

Code: Select all

{foreach from=$rawmenu item=entry}

{if $entry->type eq "separator"}
ssmItems[{$entry->number}]=["{$entry->menutext}", "", ""]
{if $entry->next_level > $entry->depth}
{if $entry->type eq "link"}
ssmItems[{$entry->number}]=["{$entry->menutext}", "{entry->url}", "{$entry->target}"]
{else}
ssmItems[{$entry->number}]=["{$entry->menutext}", "{entry->url}", ""]
{/if}

{elseif $entry->next_level eq $entry->depth}
{if $entry->type eq "link"}
ssmItems[{$entry->number}]=["{$entry->menutext}", "{entry->url}", "{$entry->target}"]
{else}
ssmItems[{$entry->number}]=["{$entry->menutext}", "{entry->url}", ""]
{/if}

{elseif $entry->next_level < $entry->depth}
{if $entry->type eq "link"}
ssmItems[{$entry->number}]=["{$entry->menutext}", "{entry->url}", "{$entry->target}"]
{else}
ssmItems[{$entry->number}]=["{$entry->menutext}", "{entry->url}", ""]
{/if}
{$entry->trenner2}
{/if}
{/if}

{/foreach}

I did this directly in the js file (after making sure that it showed up with the original tested and working text).  then tried the whole script inside the tag of my page. (inside {literal} tags, and then with {literal} wrapping everything but the part with pimenu/smarty variables.)  As soon as I try to switch it to the pimenu format it quits displaying.  :(


Does anyone have any suggestions to try or any idea what I am doing wrong?



Secondly,  I am going to want 2 menus on a given page and I don't know how to specify what levels to load on each one.  The left hand menu (script I am trying to fix above) I want to only supply the top level links.  The right hand menu should change depending on what page I am on, showing parents, siblings, and childs of the current page, except for the top level links.  I can tell that I need to use tags like load level,  next level, etc  but I don't understand how to use them.



I keep experimenting in between posts here but this is all a lot different than what I have done before and I don't know what I am doing at all - so it makes it even harder when all the instructions are in badly translated english. :)  I have made some progress though and once something clicks, THEN I understand the translation..hehe
dirtywhitellama

Re: Menu adaptation from javascript - help please

Post by dirtywhitellama »

Anyone?
cyberman

Re: Menu adaptation from javascript - help please

Post by cyberman »

dirtywhitellama wrote: This is what I did to try to make it work with CMSMS and pimenu:

Code: Select all

{foreach from=$rawmenu item=entry}

{if $entry->type eq "separator"}
ssmItems[{$entry->number}]=["{$entry->menutext}", "", ""]
{if $entry->next_level > $entry->depth}
{if $entry->type eq "link"}
ssmItems[{$entry->number}]=["{$entry->menutext}", "{entry->url}", "{$entry->target}"]
{else}
ssmItems[{$entry->number}]=["{$entry->menutext}", "{entry->url}", ""]
{/if}

{elseif $entry->next_level eq $entry->depth}
{if $entry->type eq "link"}
ssmItems[{$entry->number}]=["{$entry->menutext}", "{entry->url}", "{$entry->target}"]
{else}
ssmItems[{$entry->number}]=["{$entry->menutext}", "{entry->url}", ""]
{/if}

{elseif $entry->next_level < $entry->depth}
{if $entry->type eq "link"}
ssmItems[{$entry->number}]=["{$entry->menutext}", "{entry->url}", "{$entry->target}"]
{else}
ssmItems[{$entry->number}]=["{$entry->menutext}", "{entry->url}", ""]
{/if}
{$entry->trenner2}
{/if}
{/if}

{/foreach}

I did this directly in the js file (after making sure that it showed up with the original tested and working text).  then tried the whole script inside the tag of my page. (inside {literal} tags, and then with {literal} wrapping everything but the part with pimenu/smarty variables.)  As soon as I try to switch it to the pimenu format it quits displaying.  :(
I'm not a coder for real and no smarty specialist but the template above should be saved in a file "your_template.tpl" in directory tmp/templates. On the menu place you must call pimenu like {pimenu template="your_template.tpl"} (and other options?).

On pimenus CMSms Forge there's a template called showall.tpl. This is a developing help. It shows all smarty variables which are setted. Some smarty variables are dependent from call parameters. If there someone are not set it will show nothing.

You can try pimenu output in a blank page with {pimenu template="showall.tpl"}
Secondly,  I am going to want 2 menus on a given page and I don't know how to specify what levels to load on each one.  The left hand menu (script I am trying to fix above) I want to only supply the top level links.  The right hand menu should change depending on what page I am on, showing parents, siblings, and childs of the current page, except for the top level links.  I can tell that I need to use tags like load level,  next level, etc  but I don't understand how to use them.
Hmm, perhaps my english is too bad so I can't understand your wish  8) but it looks like a ellnav menu. In standard installation there are top level on top and sublevel on left. I think it should be possible to transform to a left / right navigation ...
so it makes it even harder when all the instructions are in badly translated english. :) 


The translation is generated by a machine  :) ... in moment I've not enough time to correct this  :-\.
Last edited by cyberman on Wed Mar 08, 2006 6:05 am, edited 1 time in total.
Locked

Return to “CMSMS Core”