Welcome to Geeklog, Anonymous Saturday, December 21 2024 @ 12:02 pm EST

Geeklog Forums

plg_menu_elements in a block?


Status: offline

vbgunz

Forum User
Full Member
Registered: 01/24/03
Posts: 169

How do I get {plg_menu_elements} to show up in a block? Better yet is it possible when any new elements are added they automatically break and create a new line for the link?

Instead of a menu that might look like this...
------
advanced search
contact FAQs forum
My Downloads

------
Get it to show in a block like this...
------
advanced search
contact
faqs
forum
my downloads
------

I am trying real hard to solve it but I am spoofed... I did the search for plg_menu_elements and it pulled back some results.. Sorry to say none was too helpful except for one which somewhat got me lost...

I read something about check in lib-common and edit into lib-custom but I guess thats where I got lost... Can someone shine some light on the subject? Thanks Smile


Victor B. Gonzalez -
http://aeonserv.com
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany

That variable is only supported in header.thtml. If you want to use it in a block, you will have to copy the code that creates it from function COM_siteHeader() in lib-common.php. To use it in a block, you will have to create a PHP block and use that code in the phpblock_... function for that block.

Since all you seem to want to have is a list of the plugin menu items in a block, something like this is all you would need (while the above would require the use of templates) (untested!):

Text Formatted Code
function phpblock_plugin_menu()
{
    $retval = '';

    $plugin_menu = PLG_getMenuItems();
    for( $i = 1; $i <= count($plugin_menu); $i++ )
    {
        $url = current($plugin_menu);
        $plg = key($plugin_menu);
        $retval .= '<a href="' . $url . '">' . $plg . '</a><br>';
        next( $plugin_menu );
    }

    return $retval;
}

Put that function in your lib-custom.php, create a new block of type PHP block, enter phpblock_plugin_menu as the name of the function and try it out ...

bye, Dirk

 Quote

Anonymous

Anonymous
Perfect! Thank you very much for the help on this one, it automatically breaks lines and is so far bug-free... I can only make one more request if possible... Using the menu plugin I am unable to integrate it with the sections block... Could this be an easy task? I am simply trying to keep navigational elements together... Otherwise the code Dirk posted works perfectly as requested. Thank you very much Dirk Smile
 Quote

MaXi-XCeL

Anonymous
Is there anyway to sort the plugins menu items alphabetically?
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by MaXi-XCeL: Is there anyway to sort the plugins menu items alphabetically?

In /path/to/geeklog/system/lib-plugins.php, in function PLG_getMenuItems, insert

ksort($menu);

just before the return $menu;

bye, Dirk
 Quote

All times are EST. The time is now 12:02 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content