Subject: Howto replace menu elements on a plugin page

Posted on: 14/03/11 10:05am
By: ::Ben

Hi everybody,

I would like to have one menu on home page and another complety different menu on my-new-plugin page.

How can I build this?

All ideas and tools are welcome. Thanks,

::Ben

Re: Howto replace menu elements on a plugin page

Posted on: 14/03/11 11:18am
By: gtgillis

Quote by: cordiste

Hi everybody,

I would like to have one menu on home page and another complety different menu on my-new-plugin page.

How can I build this?

All ideas and tools are welcome. Thanks,

::Ben



Do you mean the additional menu like the Forum adds to the top left here at geeklog.net or a complete substitution?

Re: Howto replace menu elements on a plugin page

Posted on: 14/03/11 12:43pm
By: ::Ben

Yes I try to make a complete substitution Confused:

Thanks,

::Ben

Re: Howto replace menu elements on a plugin page

Posted on: 14/03/11 12:56pm
By: Laugh

So essentially you want your plugin to display it's own set of left or right blocks sort of like a topic?

Re: Howto replace menu elements on a plugin page

Posted on: 14/03/11 02:04pm
By: ::Ben

What I would like to make is a complete substitution of the menu elements.

On my front page my menu could be :

* Contribute
* Downloads
* My cool plugin
* Links
* Polls
* Directory

And I would like on my cool plugin page :

* Trees
* Flowers
* Tools
* Fields

::Ben

Re: Howto replace menu elements on a plugin page

Posted on: 14/03/11 03:18pm
By: suprsidr

use jquery for content substitution:
PHP Formatted Code

var myMenuHTML = '<ul class="my-new-menu"><li> Trees</li><li>Flowers</li><li>Tools</li><li>Fields</li></ul>';
$('#my_normal_menu_element').html(myMenuHTML);
 


or prepend
PHP Formatted Code

var myMenuHTML = '<ul class="my-new-menu"><li> Trees</li><li>Flowers</li><li>Tools</li><li>Fields</li></ul>';
$('#my_normal_menu_element').prepend(myMenuHTML);
 

or append
PHP Formatted Code

var myMenuHTML = '<ul class="my-new-menu"><li> Trees</li><li>Flowers</li><li>Tools</li><li>Fields</li></ul>';
$('#my_normal_menu_element').append(myMenuHTML);
 


-s

Re: Howto replace menu elements on a plugin page

Posted on: 14/03/11 03:52pm
By: Roccivic

Not sure if this will be useful to you, but the alternative to a JS solution is to hack into core. You can insert the below code into lib-common.php (at line 592 in geeklog 1.7.2).

PHP Formatted Code
if (true) {
    $_CONF['menu_elements'] = array('plugins');
    $plugin_menu = array('birds' => $_CONF['site_url'] . '/birds/index.html',
                         'bees'  => $_CONF['site_url'] . '/bees/index.html');
}


Of course, you will need to replace the "always true" condition with something that will tell you whether you are on your cool plugin's page or not.

Rouslan

Re: Howto replace menu elements on a plugin page

Posted on: 14/03/11 07:17pm
By: ::Ben

Thank you for the two ways. I like both.

@ Rouslan : As I don't want to hack the core, I could tell to my plugin to display the normal menu when user is not on the "very cool plugin" page and display the second one when user is on the plugin pages.

I also see another way, I could create the first menu in a staticpage on frontpage, and use a second menu on plugin page.

Thanks,

::Ben

Re: Howto replace menu elements on a plugin page

Posted on: 15/03/11 07:31am
By: ::Ben

create the first menu in a staticpage on frontpage


As it is a project for june 2011, I have start the mock-up with a menu in staticpage.
For those interested, you can see a preview here.

::Ben

Re: Howto replace menu elements on a plugin page

Posted on: 15/03/11 09:10am
By: Laugh

One of the next features I plan to work on for Geeklog 1.8.1 is the ability to assign a plugin item a topic. This means when this item is displayed it will take on the characteristics of the topic including the blocks. This also means you will have some more control over the menu items as I plan to update the staticpage plugin to support this (ie a staticpage belonging to the News Topic would only display it's menu item if the visitor was on a page assigned to the same topic).

Re: Howto replace menu elements on a plugin page

Posted on: 15/03/11 10:10am
By: ::Ben

the ability to assign a plugin item a topic


Very good news if a plugin can have more control on the menu and block elements. :shakehands:

::Ben

Re: Howto replace menu elements on a plugin page

Posted on: 16/03/11 03:59pm
By: jmucchiello

Have you considered reading the forum code and learning how to do using the existing codebase? There are features to the sideblocks that I think only the forum makes use of. But that doesn't mean other plugin can't use it. It's just not well documented.

Geeklog - Forum
https://www.geeklog.net/forum/viewtopic.php?showtopic=92335