Is there a away to run a plugin standalone?
Let's say I only wanted the calander, or the shoutbox, or any other plugin to appear on a page without the rest of the blog...is this possible?
thanks
Standalone Plugin
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Standalone Plugin
Yes, there is. You can use this PHP code.
First the one for Serendipity 0.7:
This for Serendipity 0.8:
In both files you need to adjust $pluginname to match the name of the plugin as found in your serendipity_plugins DB table. (with the :908234098234 md5 stuff).
Regards,
Garvin
First the one for Serendipity 0.7:
Code: Select all
<?php # $Id: index.php,v 1.69 2005/01/03 18:03:39 tomsommer Exp $
chdir('/home/garvin/cvs/serendipity/serendipity_MERGE/'); // This needs to be changed to the path to your blog installation!
if (!headers_sent()) {
session_start();
}
include_once('serendipity_config.inc.php');
serendipity_login();
if (!headers_sent()) {
header('Content-Type: text/html; charset='. LANG_CHARSET);
}
$tagname = 'div';
$side = 'left';
$pluginname = 'serendipity_plugin_blah:13248f73323987de7987';
echo "<$tagname id=\"serendipity" . ucfirst($side) . "SideBar\">\n";
$plugin =& serendipity_plugin_api::load_plugin($pluginname);
$title = '';
ob_start();
if ($plugin->generate_content($title) !== false) {
$content = ob_get_contents();
$class = get_class($plugin);
ob_end_clean();
echo " <div class=\"$plugin->wrap_class sidebar_wrap_$class\">\n";
if (!empty($title)) {
echo " <h3 class=\"$plugin->title_class
sidebar_title_$class\">$title</h3>\n";
}
echo " <div class=\"$plugin->content_class sidebar_content_$class\">\n";
echo " $content\n";
echo " </div>\n";
echo " </div>\n";
} else {
ob_end_clean();
}
echo "</$tagname>\n";
/* vim: set sts=4 ts=4 expandtab : */
?>
Code: Select all
<?php
chdir('/home/garvin/cvs/serendipity/serendipity_MERGE/'); // This needs to be changed to the path to your blog installation!
if (!headers_sent()) {
session_start();
}
include_once('serendipity_config.inc.php');
serendipity_login();
if (!headers_sent()) {
header('Content-Type: text/html; charset='. LANG_CHARSET);
}
$subdir = '';
$side = 'left';
$pluginname = '@serendipity_categories_plugin:44141a11c520f4c612c733f9b7187b95';
$plugin =& serendipity_plugin_api::load_plugin($pluginname, 0, $subdir);
$class = get_class($plugin);
$title = '';
ob_start();
$show_plugin = $plugin->generate_content($title);
$content = ob_get_contents();
ob_end_clean();
if ($show_plugin !== FALSE) {
$pluginData = array(array('side' => $side,
'class' => $class,
'title' => $title,
'content' => $content));
}
serendipity_smarty_init();
$serendipity['smarty']->assign(
array(
'plugindata' => $pluginData,
'pluginside' => ucfirst($side)
)
);
serendipity_smarty_fetch('sidebar_'. $side, 'sidebar.tpl', true);
$serendipity['smarty']->display('sidebar.tpl');
?>
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/