Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

SmartyMenu 1.1 released

 
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7362
Location: Lincoln Nebraska, USA

PostPosted: Tue Oct 18, 2005 7:42 pm    Post subject: SmartyMenu 1.1 released Reply with quote

1.1 Oct 18, 2005
----------------

* remove NOTICE message, initialize $_output var (monte)
* remove erroneous </style> tag from menu_init (Dave Nuttall, monte)
* fixed bug, not respecting setItemClass() (monte)
* added loadMenu() saveMenu() resetMenu() methods
for saving menus to the PHP session (monte)

http://www.phpinsider.com/php/code/SmartyMenu/
Back to top
View user's profile Send private message Visit poster's website
TGKnIght
Smarty Junkie


Joined: 07 Sep 2005
Posts: 580
Location: Philadelphia, PA

PostPosted: Tue Jan 31, 2006 3:54 pm    Post subject: Reply with quote

Hi Monte, Thanks for working on this cool add-on.

I already had a make-shift system in place, and was considering storing the results in a session array to avoid reparsing the application structure for every page request. Looks like you beat me to the punch.

The really nice thing I like about this plugin/class combo, is that you are not forced to use the menu plugin to create the display for the menu. Even though I like the CSS menu, there are some situations where I feel it would not be appropriate for the design of the site.

Anyway what I am currently setting up for my APP is the ability to hot-swap menu styles. Of course the CSS menu is one of the options.

Here is another very basic list menu template that can be used :

(Please note this requires messju's recursion plugin which can be read about here : http://www.phpinsider.com/smarty-forum/viewtopic.php?t=291 )

Code:

{* This creates a nice little menu automatically that you can place anywhere on your site *}

<div id="menuBody">
<hr>
   {defun name="menurecursion" list=$menu}
      {foreach from=$list item=element}
         <li><a href="{$element.link}">{$element.text}</a>
            {if isset($element.submenu)}
            <ul>{fun name="menurecursion" list=$element.submenu}</ul>
            {/if}
         </li>
      {/foreach}
   {/defun}
</div>


I will be searching for a nice JavaScript menu that can handle recursion and adding it into the mix. I'll come back and post if I find anything interesting.

Thanks again!


PS
Assuming you did not specify a class for any of the items in your menu, and the default classes of nav_parent and nav_child are used, you can add this to your menu stylesheet to display an arrow indicating that the item has a submenu

Code:

#nav li.nav_parent a {
   background: White url(images/arrowright.gif) no-repeat scroll right;
}

#nav li.nav_parent ul li.nav_child a{
   background: White none;
}

#nav li.nav_parent a:hover, #nav li.nav_parent ul li.nav_child a:hover{
   color: Blue;
   background-color: Silver;
}

_________________
Smarty site with one index.php controller file
Working with MySQL and Smarty
SmartyColumnSort
Custom Smarty Javascript Debug Template
Back to top
View user's profile Send private message Visit poster's website
david63
Smarty n00b


Joined: 06 Jan 2005
Posts: 3
Location: Lancashire - UK

PostPosted: Mon Feb 06, 2006 3:35 pm    Post subject: Reply with quote

Just found this menu system and it is just what I have been looking for. It integrates into my site and works a treat.

There are, however, a couple of things that I would like to ask:

1. Is there a way to have a blank line within the menu list? This would be useful to group first level menu items together. I have tried entering a space as well as empty quotes in the "setItemText" but the menu ignores these entries.

2. Is there a way to have a "mouse over" popup to give some explanation of the menu item as with the href title?
Back to top
View user's profile Send private message
aZa
Smarty n00b


Joined: 26 Jul 2006
Posts: 2

PostPosted: Mon Jul 31, 2006 8:03 am    Post subject: Reply with quote

Heyho...

The menu is great, thanks for the work Smile

But i found a problem (maybe it's just because of wrong configuration).
I allready mentioned in the general forum but without any answers. Maybe it's better kept up here.

http://www.phpinsider.com/smarty-forum/viewtopic.php?t=8483
Back to top
View user's profile Send private message Send e-mail
talo
Smarty Rookie


Joined: 18 Oct 2005
Posts: 16

PostPosted: Tue Aug 15, 2006 10:18 am    Post subject: Cant download menu Reply with quote

Hi All,

I've tried to download the menu code using the link given at the top but the file seems to be corrupted somehow. It doesnt untar.

Please advise,
T.
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7362
Location: Lincoln Nebraska, USA

PostPosted: Tue Aug 15, 2006 1:45 pm    Post subject: Reply with quote

There is nothing wrong with the tar file.

http://www.phpinsider.com/php/code/SmartyMenu/SmartyMenu-1.1.tar.gz
Back to top
View user's profile Send private message Visit poster's website
boots
Administrator


Joined: 16 Apr 2003
Posts: 5613
Location: Toronto, Canada

PostPosted: Tue Aug 15, 2006 3:41 pm    Post subject: Reply with quote

if you are having problems with the tar file: make sure your tar is posix compliant (rather than GNU format). I believe that macs use the latter by default. (or perhaps it is the other way around -- I'm too lazy to check)
Back to top
View user's profile Send private message
talo
Smarty Rookie


Joined: 18 Oct 2005
Posts: 16

PostPosted: Thu Aug 17, 2006 9:10 am    Post subject: JavaScript file location Reply with quote

Hi All,

Tnx, i got it.

Just a little question: where must the JavaScript file reside?

Tnx,
T.
Back to top
View user's profile Send private message
talo
Smarty Rookie


Joined: 18 Oct 2005
Posts: 16

PostPosted: Thu Aug 17, 2006 12:32 pm    Post subject: Sub menu alignment Reply with quote

Hi all,

How do i get the sub menu items to align under the relative top menu item?

please help,

T.
Back to top
View user's profile Send private message
talo
Smarty Rookie


Joined: 18 Oct 2005
Posts: 16

PostPosted: Wed Mar 07, 2007 2:42 pm    Post subject: JavaScript probelm with menu Reply with quote

Hi all,

im trying to put two menus on one page. one vertical and one horizontal using the same plugin.

i've mannaged to get them both to display where i want them to as well as assign them their respective css file via the id property of the ul tag and making the following amendment to the menu_init plugin to allow multiple css file to be assigned:

Code:


if(!empty($params['css']))
{
   if(strpos($params['css'], ',') > 0)
  {
        $_css = '';
         
        $css_files = split(',', $params['css']);
         
        for($i = 0 ; $i < count($css_files) ; $i++)
        {
   $_css.= '<link rel="stylesheet" type="text/css" href="'.$css_files[$i].'" />' . "\n";
        }
   }
   else
      $_css = '<link rel="stylesheet" type="text/css" href="'.$params['css'].'" />' . "\n";
}
else
{
   $_css = null;
}



the new call to menu_init would be something like this:
Code:
 {menu_init css="css/menu_ver.css,css/menu_hor.css"}


my prblem now come in the javascript.

because it only works for one menu with the id e.g. "nav"

now i made a second one and gave it the id "nav_hor"

how do i amend the JS part in the menu_init to make them both work?

i tried doing to following but it doesnt work:

Code:


sfHover = function() {
    //for the first menu
    var sfEls = document.getElementById("nav").getElementsByTagName("LI");
    for (var i=0; i<sfEls.length; i++) {
        sfEls[i].onmouseover=function() {
            this.className+=" sfhover";
        }
        sfEls[i].onmouseout=function() {
            this.className=this.className.replace(new RegExp(" sfhover\\\\b"), "");
        }
    }
   // for the second menu
   var sfEls1 = document.getElementById("nav_hor").getElementsByTagName("LI");
    for (var j=0; j<sfEls1.length; i++) {
        sfEls1[j].onmouseover=function() {
            this.className+=" sfhover2";
        }
        sfEls1[j].onmouseout=function() {
            this.className=this.className.replace(new RegExp(" sfhover2\\\\b"), "");
        }
    }
}


please if any of you have done someting like this before can you help.
an example would be greatlly appreciated.

thanks,
T.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP