So, here is the deal, I am writting a plugin that adds some features to a few specific pages. And I'm basically done with it, however, since so far I've been having trouble with rewritting pages, I've done it in the original plugin.
Basically what I need to do is have the page at the ULR
http://localhost/elgg-1.8.16/photos/siteimagesowner/
show my page instead of the one in the plugin (which I still need because the plugin does a bunch of other stuff.)
The origial file was in \mod\tidypics\pages\lists, and I've made my hierarchy match this.
However, no matter how much I try, I simply cannot get the start.php to regster it correctly; so far I have the flollowing
////BEGIN start.php
elgg_register_event_handler('init', 'system', 'spikeDefaultmod_init');
function spikeDefaultmod_init() {
$base_dir = elgg_get_plugins_path() . 'SpikeModDefaults/lib';
elgg_register_page_handler('photos', 'spikeDefault_page_handler');}
/*
function spikeDefault_page_handler($page) {
if (!isset($page[0])) return false;
elgg_load_js('tidypics');
$base = elgg_get_plugins_path() . 'SpikeModDefaults/pages/photos';
$base_lists = elgg_get_plugins_path() . 'SpikeModDefaults/pages/lists';
switch ($page[0]) {
case "siteimagesowner":
if (isset($page[1])) {
set_input('guid', $page[1]);}
require "$base_lists/siteimagesowner.php";
break;}
default:
return false;}
return true;}
*/
which simply freezes and breaks the program.
I also looked into using the elgg_register_page_handler() function, but it did not help as much as I needed it to. If someone could direct me to the right directio, I would be super glad. I simply cannot wrapmy head around this one.
Thanks in advance!
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.
- Matt Beckett@Beck24

Matt Beckett - 0 likes
You must log in to post replies.using elgg_register_page_handler will require you to replace *every* page starting with photos/
To replace a single page you should look at the route hook
elgg_register_plugin_hook_handler('route', 'photos', 'my_photos_handler');