thank you @iionly
i found the line in the start.php, what is 'commenting' ?
elgg_unextend_view('page/elements/header', 'search/header');
elgg_extend_view('page/elements/sidebar', 'search/header', 0);
Commenting out these two lines and flushing the cache of Elgg via admin area should move the search field back to the header.
There are two ways to add comments in PHP. See http://php.net/manual/en/language.basic-syntax.comments.php. /* (and for closing */) is mainly used for comments longer than a single line. With // you can make a single line comment, i.e. everything in the line after // gets ignored. "Commenting out" just means that you make a certain part of code (1 line or several lines) a comment, e.g. by adding // at the beginning of these lines of codes and this code then gets ignored.
Update: I did it! I created a basic plugin and added my logo to the top bar. Woo!
thats great - consider releasing it for public use, however small it may be @ zerosandones
I guess you got the info from http://learn.elgg.org/en/stable/guides/themes.html#customizing-the-front-page. Unfortunately, this info is no longer correct (it was for older versions of Elgg but it's no longer working this way on any recent version of Elgg).
Most likely the simpliest way is described at http://learn.elgg.org/en/stable/tutorials/indexpage.html. So, follow the instructions for overriding views (http://learn.elgg.org/en/stable/guides/views.html#altering-views-via-plugins) and you would only need to place your modified index.php in mod/YOUR_PLUGIN/views/default/resources/index.php. Apart from that you only need a manifest.xml and a start.php (<?php in the first line is all that needs to be in start.php at a minimum).
The other way that still works is with
elgg_register_page_handler('','my_index');
in the init function of your plugin and the function
function my_index() {
if (!include_once(dirname(__FILE__) . "/index.php")) {
return false;
}
// return true to signify that we have handled the front page
return true;
}
also in start.php. The path used in include_once might have to be adjusted depending on where you placed your index.php.
Thank you iionly
I tried both ways:
1.- With an empty start.php
--
<?php
--
and mod/MYPLUGIN/views/default/resources/index.php
--
<?php
$params = array(
'title' => 'Hello world!',
'content' => 'My first page!',
'filter' => '',
);
$body = elgg_view_layout('content', $params);
echo elgg_view_page('Hello', $body);
--
and then
2.- with start.php
--
<?php
// usual stuff
elgg_register_event_handler('init', 'system', 'indice2_init');
// plugin init function
function indice2_init() {
// Replace the default index page
// elgg_register_plugin_hook_handler('index', 'system', 'new_index');
elgg_register_page_handler('','my_index');
}
function my_index() {
if (!include_once(dirname(__FILE__) . "/pages/index.php")) {
return false;
}
// return true to signify that we have handled the front page
return true;
}
--
and mod/MYPLUGIN/pages/index.php with just the content as before.
Both produce an identical output as far as I can see. I then went back to the original start.php code in http://learn.elgg.org/en/stable/guides/themes.html#customizing-the-front-page
--
<?php function pluginname_init() { // Replace the default index page elgg_register_plugin_hook_handler('index', 'system', 'new_index'); } function new_index() { if (!include_once(dirname(dirname(__FILE__)) . "/pluginname/pages/index.php")) return false; return true; } // register for the init, system event when our plugin start.php is loaded elgg_register_event_handler('init', 'system', 'pluginname_init'); ?>
--
and, again, it all went well. The original error must have been in my index.php.
Thank you for your lead.
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.