We are adding Elgg as a new feature of our existing site, so I need to make Elgg look like our main website. I am using a complex JS + CSS megamenu system in the main website.
I would appreciate some input on how to go about writing a plugin to remove the default Elgg menu and insert the megamenu files from our main website. If it matters, Elgg is installed in a different directory on the same server as our primary site.
References I have reviewed already include http://community.elgg.org/pg/plugins/project/819003/developer/_13net/menu-manager-for-18 and http://docs.elgg.org/wiki/Menus.
I am using EasyTheme to modify the site's appearance, so the menu solution will need to be compatible with it.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Steve Clay@steve_clay
Steve Clay - 0 likes
- Paul in Boise@PaulInBoise
Paul in Boise - 0 likes
- Paul in Boise@PaulInBoise
Paul in Boise - 0 likes
- ihayredinov@ihayredinov
ihayredinov - 0 likes
- Paul in Boise@PaulInBoise
Paul in Boise - 0 likes
- Evan Winslow@ewinslow
Evan Winslow - 0 likes
You must log in to post replies.The easiest way is to add a plugin that overrides the page/default view. This view is a wrapper for the entire markup of the page. In your copy, you can then change whatever you like.
Thank you. I am currently looking at myElggfolder\views\default\page\default.php and it seems to have the entire page markup. I will inspect that to see if I can find the variables and classes that need to be overwritten. This is my first plugin, so I'll probably be posting again soon.
My first goal is to simply eliminate the default Elgg menu. I created a plugin named "page-wrapper-override" since I'll be doing other wrapper manipulation later.
I found in elggdir/views/default/page/elements/header.php on line 13:
// insert site-wide navigation
echo elgg_view_menu('site');
It appears this is where the menu is embedded. In my plugin, I copied all the code from the core header.php file to /mod/page-wrapper-override/views/default/page_elements/elgg_header.php, and then removed the line that inserts the site menu.
The plugin appears in Elgg and activates normally, but I still see the default Elgg menu.
I built my directory names based on http://docs.elgg.org/wiki/Views/Creating_a_new_site_theme and http://docs.elgg.org/wiki/Overriding_a_view
I also tried structuring the plugin to: /mod/page-wrapper-override/views/default/elements/header.php with the same result.
Since I have bigger plans for the plugins, I have several empty placeholder files. Could that cause the problem?
You are misunderstanding Elgg's view system. To overload a specific view you need to replicate it's path in your plugin. So, the new header should be in /mod/page-wrapper-override/views/default/page/elements/header.php
Make sure you disable path caching, or run upgrade.php
That worked. Thank you.
Is the documentation I was following that specified /views/default/page_elements/ for a previous version of Elgg?
Yes, that documentation was for 1.7. 1.8 changed the location of many views.