Subject: Putting menu_elements in a block?

Posted on: 24/04/03 02:34pm
By: klync

So, I'm working on a block that will combine the "User Functions" with the "menu_elements" (and, of course, plg_menu_elements), creating a single place on the page for all of these, called "Actions". I didn't have much trouble finding the code in lib-common.php to copy and paste into my new function in lib-custom.php for the User Functions. I am having a hard time reproducing the "menu_elements" part. Any suggestions?

Putting menu_elements in a block?

Posted on: 24/04/03 02:45pm
By: Dirk

So what exactly is your problem? What we have here is a nested template, i.e. a template (header.thtml) includes another template (menuitem.thtml). So the line $header->parse( 'menu_elements', 'menuitem', true ); parses the 'menuitem' template and puts the result into the {menu_elements} variable in the header template. This is done repeatedly (for each menu item), thus producing the menu bar. Hope that helps. bye, Dirk

Putting menu_elements in a block?

Posted on: 24/04/03 08:48pm
By: squatty

How is this any different then the current menu plugin?---Danny @

I've got it!

Posted on: 25/04/03 12:27pm
By: Anonymous

Thanks for pointing me in the right direction, guys. I checked out the menu plugin, and it didn't do exactly what I had in mind. I meditated on your comment, Dirk..... And, finally, it came to me.

I mentioned that I had made a new phpblock in lib-custom by ripping out the code from lib-common. Well, since that's my own custom function, I found it easy to change the menu items by adding, removing and modifying the four line stanzas. So, for example my "Get Published" link appears thanks to this code:

$adminmenu->set_var( 'option_url', $_CONF['site_url'] . '/submit.php?type=story' ); $adminmenu->set_var( 'option_label', $LANG01[71] ); $adminmenu->set_var( 'option_count', '' ); $retval .= $adminmenu->parse( 'item', 'option' );

Now I get a bit better of an idea how the templates work, since they're set up a the beginning of the function to draw the "User Functions" block.

Geeklog - Forum