ShogS Posted September 13, 2012 Group: Members Topic Count: 13 Topics Per Day: 0.00 Content Count: 91 Reputation: 8 Joined: 03/03/12 Last Seen: October 2, 2020 Share Posted September 13, 2012 Question I just want to put a Admin menu in a List/Menu or Jump Menu Here's my code but it won't work for me <form name="form1"> <select name="menu1" onChange="MM_jumpMenu('parent',this,0)"> <?php $mItems = array(); foreach ($adminMenuItems as $menuItem) $mItems[] = sprintf('<a href="%s">%s</a>', $menuItem['url'], $menuItem['name']) ?> <strong>Admin</strong>: <option><?php echo implode(' • ', $mItems) ?></option></select> <?php endif ?> </form> it only appears like this Admin: Who's Online • Item Database • eA Logs • CP Logs • IP Ban List • Accounts • Characters • Guilds • Reload • Send Mail • News • Pages Any one can help me pls? tnx in advance Quote Link to comment Share on other sites More sharing options...
Heero Yuy Posted September 13, 2012 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 68 Reputation: 12 Joined: 09/05/12 Last Seen: December 22, 2012 Share Posted September 13, 2012 (edited) Are you trying to make a dropdown menu? If that is the case, then you can try this: <?php if (!empty($adminMenuItems) && Flux::config('AdminMenuNewStyle')): ?> <form name="form1"> <?php $mItems = array(); foreach ($adminMenuItems as $menuItem) $mItems[] = sprintf('<a href="%s">%s</a>', $menuItem['url'], $menuItem['name']) function createDropdown($arr, $frm) { echo '<select name="'.$frm.'" id="'.$frm.'"> <option value="">Select one…</option>'; foreach ($arr as $key => $value) { echo '<option value="'.$value.'">'.$value.'</option>'; } echo '</select>'; } ?> <label for="frmadminmenu">Admin Menu:</label> <!--?php createDropdown($mItems, 'frmadminmenu'); ?--> </form> <?php endif ?> Edited September 13, 2012 by Heero Yuy Quote Link to comment Share on other sites More sharing options...
ShogS Posted September 13, 2012 Group: Members Topic Count: 13 Topics Per Day: 0.00 Content Count: 91 Reputation: 8 Joined: 03/03/12 Last Seen: October 2, 2020 Author Share Posted September 13, 2012 Are you trying to make a dropdown menu? If that is the case, then you can try this: <?php if (!empty($adminMenuItems) && Flux::config('AdminMenuNewStyle')): ?> <form name="form1"> <?php $mItems = array(); foreach ($adminMenuItems as $menuItem) $mItems[] = sprintf('<a href="%s">%s</a>', $menuItem['url'], $menuItem['name']) function createDropdown($arr, $frm) { echo '<select name="'.$frm.'" id="'.$frm.'"> <option value="">Select one…</option>'; foreach ($arr as $key => $value) { echo '<option value="'.$value.'">'.$value.'</option>'; } echo '</select>'; } ?> <label for="frmadminmenu">Admin Menu:</label> <!--?php createDropdown($mItems, 'frmadminmenu'); ?--> </form> <?php endif ?> still not working sir when i put you code the page won't load anymore Quote Link to comment Share on other sites More sharing options...
Jupeto Posted September 13, 2012 Group: Members Topic Count: 34 Topics Per Day: 0.01 Content Count: 225 Reputation: 39 Joined: 01/20/12 Last Seen: October 6, 2024 Share Posted September 13, 2012 (edited) Admin Drop Down Menu <form name="form1"> <strong>Admin</strong>: <select name="menu1" onChange="MM_jumpMenu('parent',this,0)"> <?php foreach ($adminMenuItems as $menuItem) : ?> <option value="<?php echo $menuItem['url']; ?>"><?php echo $menuItem['name']; ?></option> <?php endforeach; ?> </select> </form> I don't know what your 'MM_jumpMenu()' function does but that code should work... Just play around EDIT: and btw, sprintf('<a href="%s">%s</a>', $menuItem['url'], $menuItem['name']) that code produce a url tag which you cannot put inside a combo box, use '<?php echo $menuItem['url']; ?>' instead if you want to get just the url of the menu and place it in the value property of an option tag Edited September 13, 2012 by Jupeto Quote Link to comment Share on other sites More sharing options...
ShogS Posted September 13, 2012 Group: Members Topic Count: 13 Topics Per Day: 0.00 Content Count: 91 Reputation: 8 Joined: 03/03/12 Last Seen: October 2, 2020 Author Share Posted September 13, 2012 Admin Drop Down Menu <form name="form1"> <strong>Admin</strong>: <select name="menu1" onChange="MM_jumpMenu('parent',this,0)"> <?php foreach ($adminMenuItems as $menuItem) : ?> <option value="<?php echo $menuItem['url']; ?>"><?php echo $menuItem['name']; ?></option> <?php endforeach; ?> </select> </form> I don't know what your 'MM_jumpMenu()' function does but that code should work... Just play around EDIT: and btw, sprintf('<a href="%s">%s</a>', $menuItem['url'], $menuItem['name']) that code produce a url tag which you cannot put inside a combo box, use '<?php echo $menuItem['url']; ?>' instead if you want to get just the url of the menu and place it in the value property of an option tag Sir jupeto the drop down menu works but it won't redirect me on every menu i choose sample who is online. it won't go. Quote Link to comment Share on other sites More sharing options...
Jupeto Posted September 13, 2012 Group: Members Topic Count: 34 Topics Per Day: 0.01 Content Count: 225 Reputation: 39 Joined: 01/20/12 Last Seen: October 6, 2024 Share Posted September 13, 2012 (edited) Ekk then what's the use of that function in onChange property? find: onChange="MM_jumpMenu('parent',this,0)" replace with: onChange="window.location.href=this.value" or just copy below <form name="form1"> <strong>Admin</strong>: <select name="menu1" onChange="window.location.href=this.value"> <option value="javascript:void(0);">Choose Menu</option> <?php foreach ($adminMenuItems as $menuItem) : ?> <option value="<?php echo $menuItem['url']; ?>"><?php echo $menuItem['name']; ?></option> <?php endforeach; ?> </select> </form> Edited September 13, 2012 by Jupeto 1 Quote Link to comment Share on other sites More sharing options...
ShogS Posted September 13, 2012 Group: Members Topic Count: 13 Topics Per Day: 0.00 Content Count: 91 Reputation: 8 Joined: 03/03/12 Last Seen: October 2, 2020 Author Share Posted September 13, 2012 @jupeto it works now sir. asahan mo po creds ko seo for this website hehehe tnx a lot Quote Link to comment Share on other sites More sharing options...
ShogS Posted September 18, 2012 Group: Members Topic Count: 13 Topics Per Day: 0.00 Content Count: 91 Reputation: 8 Joined: 03/03/12 Last Seen: October 2, 2020 Author Share Posted September 18, 2012 @sir Jupeto - hmmmm how about on SubMenus and Page Menus? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.