Hi,
I was trying to create external pages for my website and suddenly got this error. Please help as I am unable to find out the error. The code of the start.php is also mentioned below.
Error
PHP code in Start.php
<?php
/**
* Plugin for creating web pages for your site
*/
elgg_register_event_handler('init', 'system', 'expages_init');
function expages_init() {
// Register a page handler, so we can have nice URLs
elgg_register_page_handler('about', 'expages_page_handler');
elgg_register_page_handler('terms', 'expages_page_handler');
elgg_register_page_handler('privacy', 'expages_page_handler');
//elgg_register_page_handler('terms & conditions', 'expages_page_handler');
/**
elgg_register_page_handler('privacy', 'expages_page_handler');
elgg_register_page_handler('Terms', 'expages_page_handler');
elgg_register_page_handler('expages', 'expages_page_handler');
// Register public external pages
elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'expages_public');
// add a menu item for the admin edit page
elgg_register_admin_menu_item('configure', 'expages', 'appearance');
// add footer links
expages_setup_footer_menu();
// register action
$actions_base = elgg_get_plugins_path() . 'externalpages/actions';
elgg_register_action("expages/edit", "$actions_base/edit.php", 'admin');
}
/**
* Extend the public pages range
*
*/
function expages_public($hook, $handler, $return, $params){
$pages = array('about', 'terms', 'privacy');
return array_merge($pages, $return);
}
/**
* Setup the links to site pages
*/
function expages_setup_footer_menu() {
$pages = array('about', 'terms', 'privacy');
foreach ($pages as $page) {
$url = "$page";
$wg_item = new ElggMenuItem($page, elgg_echo("expages:$page"), $url);
elgg_register_menu_item('walled_garden', $wg_item);
$footer_item = clone $wg_item;
elgg_register_menu_item('footer', $footer_item);
}
}
/**
* External pages page handler
*
* @param array $page URL segements
* @param string $handler Handler identifier
* @return bool
*/
function expages_page_handler($page, $handler) {
if ($handler == 'expages') {
expages_url_forwarder($page[1]);
}
$type = strtolower($handler);
$title = elgg_echo("expages:$type");
$header = elgg_view_title($title);
$object = elgg_get_entities(array(
'type' => 'object',
'subtype' => $type,
'limit' => 1,
));
if ($object) {
$content .= elgg_view('output/longtext', array('value' => $object[0]->description));
} else {
$content .= elgg_echo("expages:notset");
}
$content = elgg_view('expages/wrapper', array('content' => $content));
if (elgg_is_logged_in() || !elgg_get_config('walled_garden')) {
$body = elgg_view_layout('one_sidebar', array('title' => $title, 'content' => $content));
echo elgg_view_page($title, $body);
} else {
elgg_load_css('elgg.walled_garden');
$body = elgg_view_layout('walled_garden', array('content' => $header . $content));
echo elgg_view_page($title, $body, 'walled_garden');
}
return true;
}
/**
* Forward to the new style of URLs
*
* @param string $page
*/
function expages_url_forwarder($page) {
global $CONFIG;
$url = "{$CONFIG->wwwroot}{$page}";
forward($url);
}
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
- iionly@iionly
iionly - 0 likes
You must log in to post replies.That usually means you're missing a semi-colon at the end of a statement, though I don't see where (most likely line 109, but they're not numbered here)
Did you modify this file? It's a core plugin so you shouldn't have. Replace it with a fresh copy.
You have commented out the closing } of the expages_init() function at least (there might be other errors additionally):
All the lines in bold are commented out.