Subject: [SOLVED] Question about the SEARCH_RESULT_FULLPAGE-hook
Hello everyone,
I try to create a plugin which shows an icon in front of a search result, if the page is in a certain namespace. Until now, I hacked the dokuwiki-core to achieve this, but with the upgrade to Greebo my hack doesn't work any more, so I decided to write a plugin. I've written a small plugin two years ago and have a bit experience with the basics of plugin programming, but I'm really no expert.
As a first step, I tried to simply show the text TEST in front of every search result, and implement the condition if the page is in a given namespace after this works. But I'm not able to get even this functionality running. Maybe someone has a clue for me what I did wrong?
Here is the code of my action.php I've got so far. I created a plugin skeleton with the wizard, but since this is the only file where I've changed something I guess the other files are not necessary to lead me to the right way. If they are, you can find the whole (not working) plugin at github: https://github.com/cziehr/dokuwiki-plugin-nsiconinsearch
Thanks,
Christoph
I try to create a plugin which shows an icon in front of a search result, if the page is in a certain namespace. Until now, I hacked the dokuwiki-core to achieve this, but with the upgrade to Greebo my hack doesn't work any more, so I decided to write a plugin. I've written a small plugin two years ago and have a bit experience with the basics of plugin programming, but I'm really no expert.
As a first step, I tried to simply show the text TEST in front of every search result, and implement the condition if the page is in a given namespace after this works. But I'm not able to get even this functionality running. Maybe someone has a clue for me what I did wrong?
Here is the code of my action.php I've got so far. I created a plugin skeleton with the wizard, but since this is the only file where I've changed something I guess the other files are not necessary to lead me to the right way. If they are, you can find the whole (not working) plugin at github: https://github.com/cziehr/dokuwiki-plugin-nsiconinsearch
<?php
if (!defined('DOKU_INC')) {
die();
}
class action_plugin_nsiconinsearch extends DokuWiki_Action_Plugin
{
public function register(Doku_Event_Handler $controller)
{
$controller->register_hook('SEARCH_RESULT_FULLPAGE', 'BEFORE', $this, 'handle_search_result_fullpage');
}
public function handle_search_result_fullpage(Doku_Event $event, $param)
{
$event->data['resultHeader'][] = '<p>TEST</p>';
}
}
if (!defined('DOKU_INC')) {
die();
}
class action_plugin_nsiconinsearch extends DokuWiki_Action_Plugin
{
public function register(Doku_Event_Handler $controller)
{
$controller->register_hook('SEARCH_RESULT_FULLPAGE', 'BEFORE', $this, 'handle_search_result_fullpage');
}
public function handle_search_result_fullpage(Doku_Event $event, $param)
{
$event->data['resultHeader'][] = '<p>TEST</p>';
}
}
Thanks,
Christoph

Edit reason: Changed code with advise from Myron from the second post