Hello
I am trying to replicate the Developers Plugin into a new plugin named Curriculum with the code same, just the names have changed to curriculum
https://github.com/Elgg/Elgg/tree/5.1/mod/developers/classes/Elgg/Developers
How then should I build the route so that it points to the init() function in the Bootstrap class, so that I can access it via the following link http://myolivebooks.com/curriculum.
Can I do it with an init() file
Still trying the learn the system. So don't mind....
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.
- Topol@Topol
Topol - 0 likes
- Jerome Bakker@jeabakker
Jerome Bakker - 0 likes
- Topol@Topol
Topol - 0 likes
- Jerome Bakker@jeabakker
Jerome Bakker - 0 likes
You must log in to post replies.What I really meant to ask was that when I do the following steps, its working...
https://learn.elgg.org/en/stable/tutorials/hello_world.html,
i can route it....
But I wanted to ask whether I could route the same from the Bootstrapclass() init() function....
For I have to load external js files
If you have a resource file (where you draw the page) you can load the JS you need on that page, with the function elgg_require_js()
If you have JS you need on every page (mostly not the case) you can extend the elgg.js view in your elgg-plugin.php. Or you could make a Bootstrap class, register is in the elgg-plugin.php and the init() function (if done correctly) will automatically be called on every page.
You see, I followed the Developers plugin, but could not understand how it was routing and registering it in the menu.....
Please clarify this setup, for my routing, I need to put my php files in the following location:
/var/www/html/elgg/mod/curriculum/views/default/resources
But in the bootstrap init() function, if I want to cal the code,
elgg_register_external_file('js', 'curriculum', elgg_get_simplecache_url('js/curriculum.js'));
elgg_load_external_file('js', 'curriculum');
or load a php file, all the js and php files should be in the resources folder only,
or whether it should be in the folder which has the bootstrap file....for since init() function would call it in every page....
I don't think the Developers plugin is a good example of how you should route to content pages.
Best have a look at the Blog plugin.
Routes are defined here:
https://github.com/Elgg/Elgg/blob/59cb99044e35d26f4812d0bd3edb5f674203d9f3/mod/blog/elgg-plugin.php#L27-L105
Learn more about routing http://learn.elgg.org/en/stable/guides/routing.html
The loading of a JS file can be seen here
https://github.com/Elgg/Elgg/blob/59cb99044e35d26f4812d0bd3edb5f674203d9f3/mod/blog/views/default/forms/blog/save.php#L6
and the JS file is located in /mod/blog/views/default/forms/blog/save.js
elgg_register_external_file() and elgg_load_external_file() shouldn't be needed is most cases.
Learn more about JS in Elgg http://learn.elgg.org/en/stable/guides/javascript.html
You also mentioned menu items, check this http://learn.elgg.org/en/stable/guides/menus.html
In the Blog plugins this is registered here
https://github.com/Elgg/Elgg/blob/59cb99044e35d26f4812d0bd3edb5f674203d9f3/mod/blog/elgg-plugin.php#L117-L131