Placing output of plugin not aside
Placing output of plugin not aside
Hi,
today I'd an idea for a plugin but therefore I'd like to know if it is possible to place the output between #serendipity_banner and #mainpane, for example.
Thanks, Thomas
today I'd an idea for a plugin but therefore I'd like to know if it is possible to place the output between #serendipity_banner and #mainpane, for example.
Thanks, Thomas
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Placing output of plugin not aside
You'd have to edit your layout.php file for that to be possible, and insert an event_hook there...
Regards,
Garvin
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Well, take your layout.php and insert
in the place after your #mainpane. Then create a plugin which enlists itself for the 'tomscorner_top' hook, and at the event_hook() function of your plugin, insert a case statement for what to output at that hook position. Just look at existing plugins and how they use event hooks. The karma plugin should maybe be a good pointer for you, despite of it's overload
Regards,
Garvin.
Code: Select all
serendipity_plugin_api::hook_event('tomscorner_top', $serendipity);
Regards,
Garvin.
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Hi,
ok, well, I made a simple example working.
There are a view questions left:
ok, well, I made a simple example working.
There are a view questions left:
- get_config(): the values I can give as argument to this function are restricted to the plugin only or am I able to see others as well? If yes how to find out which values can I get from get_config()?
- Is it possible when calling a plugin through an event_hook first to get true or false back to see if the plugin is enabled or not? This is therefore to display the output of the plugin in a seperate table only then when the plugin is enabled. Otherwise an emptry table would be displayed which avtually doesn't look that nice
- Database tables: may plugins have database tables?
- Plugin API: the docs are ok but in some cases not very helpful
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi Thomas!
If you find cases where information is missing, please let me know and I try to fill in the gaps. The more precise your question is, the better I can document the answer
Thanks,
Garvin.
You are righ, $this->get_config() is restricted to a single plugin. The values you are able to fetch are the ones you specify in the introspect function. (array 'configuration').
- get_config(): the values I can give as argument to this function are restricted to the plugin only or am I able to see others as well? If yes how to find out which values can I get from get_config()?
Actually you don't use the hook_event() function to spawn a single plugin, but all plugins which listen to that event. So if there are none plugins listening to that, nothing happens. The event hook does not return a true/false, but you can set values you specify within the function ($eventData and $addData). So you can set a value flag to tell your layout.php whether a certain case has happened or not. The most easy way would be to do this:[*]Is it possible when calling a plugin through an event_hook first to get true or false back to see if the plugin is enabled or not? This is therefore to display the output of the plugin in a seperate table only then when the plugin is enabled. Otherwise an emptry table would be displayed which avtually doesn't look that nice
Code: Select all
<?php
ob_start()
serendipity_plugin_api::hook_event('myevent');
$data = ob_get_contents();
ob_end_clean();
if (!empty($data) {
?>
do wicked html table stuff
<?php echo $data; ?_
end wicked html table stuff
<?php
}
?>
If you need it for extra data, yes. The shoutbox and karma plugins create a seperate table, for example.[*]Database tables: may plugins have database tables?
Yeah, we have our drawbacks there because it doesn't get updated frequently. We're programmers, not writers -- so we need help with someone documenting...[*]Plugin API: the docs are ok but in some cases not very helpful
If you find cases where information is missing, please let me know and I try to fill in the gaps. The more precise your question is, the better I can document the answer
Thanks,
Garvin.
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Hey Garvin,
The code you added is much better and logical. Jesus, why do I lack of such ideas? That would make my idea working!
For example some internal information about special functionalities which might be also used outside the class (I mean private and public functions as they're called so in PHP5).
I think I'll take some time in reading through a couple scripts.
I really salute you and your team. It's really amazing how you can maintain and grow your project. I had once a PHP project as well but stumbled finally across my own laziness and the lost ability to maintain the code. <applaus> Gratulations at this point </applaus>
Question answered.You are righ, $this->get_config() is restricted to a single plugin. The values you are able to fetch are the ones you specify in the introspect function. (array 'configuration').
Well, can those data vars be appended at serendipity_plugin_api::hook_event('myevent')? Actually that wouldn't give any additional functionality except data strings if the function would need it. But for the layout.php there's no advantage for.The event hook does not return a true/false, but you can set values you specify within the function ($eventData and $addData).
The code you added is much better and logical. Jesus, why do I lack of such ideas? That would make my idea working!
Seems that I have to analyze the Karma plugin more carefully. The code there overloaded my brain already once.If you need it for extra data, yes. The shoutbox and karma plugins create a seperate table, for example.
Here I have a problem: since I do not know what functions or additional information should be added I cannot suggest you to add someting.Yeah, we have our drawbacks there because it doesn't get updated frequently. We're programmers, not writers -- so we need help with someone documenting...
If you find cases where information is missing, please let me know and I try to fill in the gaps. The more precise your question is, the better I can document the answer
For example some internal information about special functionalities which might be also used outside the class (I mean private and public functions as they're called so in PHP5).
I think I'll take some time in reading through a couple scripts.
I really salute you and your team. It's really amazing how you can maintain and grow your project. I had once a PHP project as well but stumbled finally across my own laziness and the lost ability to maintain the code. <applaus> Gratulations at this point </applaus>
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi Thomas!
Hm, what do you mean? Yes, you can modify contents of $eventData and $addData, as they are passed as references...?Well, can those data vars be appended at serendipity_plugin_api::hook_event('myevent')? Actually that wouldn't give any additional functionality except data strings if the function would need it. But for the layout.php there's no advantage for.The event hook does not return a true/false, but you can set values you specify within the function ($eventData and $addData).
Well, yes - I do agree it's a bit complicated; but mighty, mighty, in the endSeems that I have to analyze the Karma plugin more carefully. The code there overloaded my brain already once.
Well, we have the serendipity_plugin_api.php file which documents all available functions, maybe that is a help for you? But yes, there is a lack of PHP-code documentation, but I think someone took onto that job somewhen..Here I have a problem: since I do not know what functions or additional information should be added I cannot suggest you to add someting.
For example some internal information about special functionalities which might be also used outside the class (I mean private and public functions as they're called so in PHP5).
that's actually the best way to do thingsI think I'll take some time in reading through a couple scripts.
Thanks a lot, this is much appreciated!I really salute you and your team. It's really amazing how you can maintain and grow your project. I had once a PHP project as well but stumbled finally across my own laziness and the lost ability to maintain the code. <applaus> Gratulations at this point </applaus>
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Well, what $eventData is I know already. But what is $addData for?garvinhicking wrote:Hm, what do you mean? Yes, you can modify contents of $eventData and $addData, as they are passed as references...?
It seems that I have to read more and more ...Well, we have the serendipity_plugin_api.php file which documents all available functions, maybe that is a help for you? But yes, there is a lack of PHP-code documentation, but I think someone took onto that job somewhen..
You're welcomeThanks a lot, this is much appreciated!
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi Thomas!
It's for "additional Data", or flags/variables you want to pass to the function, but are not part of $eventData. At some point it got needed because of various reasons and was better for compatibility and speed to create a second variable. Thinking about it, I just found out, that $addData is not passed by reference.Well, what $eventData is I know already. But what is $addData for?
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
top of content
I am trying to make the shoutbox to show on top of all entries instead of the side bar.
jsut wondering where I should put this serendipity_plugin_api::hook_event('tomscorner_top', $serendipity) hook event if I use 0.8 version?
Thanks.
jsut wondering where I should put this serendipity_plugin_api::hook_event('tomscorner_top', $serendipity) hook event if I use 0.8 version?
Thanks.
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: top of content
You can place that hook in your templates/XXX/index.tpl file. Look at how the sidebars are implemented. If you don't use the right sidebar, you should use that as your top-sidebar and place it via HTML where you want the output. Then only assign the shoutbox plugin the the right side, and all others to the left side and you're done.
Regards,
Garvin
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
sidebar
I am gonna use the sidebars (both left and right) .
so, let me try to get this right.
1st, I need to add a event hook in the index.tpl file
2nd, in the shoutbox plugin, add and event_hook() function and insert a case statement for what to output at that hook position
how does the invocation work ?
sorry I am a very newbie of s9y and still learning about how s9y works.
so, let me try to get this right.
1st, I need to add a event hook in the index.tpl file
2nd, in the shoutbox plugin, add and event_hook() function and insert a case statement for what to output at that hook position
how does the invocation work ?
sorry I am a very newbie of s9y and still learning about how s9y works.
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: sidebar
Yesterday I committed the possibility to place this code anywhere in your *.tpl files of your template:
{serendipity_showPlugin class="serendipity_plugin_shoutbox"}
This should then show the shoutbox at the place.
Regards,
Garvin
{serendipity_showPlugin class="serendipity_plugin_shoutbox"}
This should then show the shoutbox at the place.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/