Hi.
I have a standard three-column layout on my website, http://www.mzh.dk.
I have placed the actual blog (i.e. the entries) in the middle column, but now I would like to know if it is possible to display some of the built-in sidebar items (calendar and archive) in the left or right column.
The site is PHP-based, so I have the possibility of doing server-side includes, but I don't know how to generate the actual sidebar items outside Serendipity - is it at all possible?
Mikkel
Move sidebar items
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Move sidebar items
Yes, this is possible.
You can use this PHP code snippet:
This would create all right sidebar elements you have configured in your serendipity.
Another solution is to create single instances of a plugin, which could also be set to a 'hidden' display within the serendipity plugin manager:
Set $pluginname to the full instance name of the plugin you want to show.
The example are based on Serendipity 0.8. You could also go the easier way and integrate your site into the Smarty Templates of Serendipity instead, or put your own left and right sidebar into HTML Nuggets or seperate PHP Include Plugins and then make Serendipity output your whole page, and not your page include Serendipity.
Regards
Garvin
You can use this PHP code snippet:
Code: Select all
<?php
chdir('/home/garvin/cvs/serendipity/serendipity_MERGE/'); // This needs to be changed to the path to your blog installation!
include_once('serendipity_config.inc.php');
print_r(serendipity_plugin_api::generate_plugins('right', 'div'));
?>
Another solution is to create single instances of a plugin, which could also be set to a 'hidden' display within the serendipity plugin manager:
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');
?>
The example are based on Serendipity 0.8. You could also go the easier way and integrate your site into the Smarty Templates of Serendipity instead, or put your own left and right sidebar into HTML Nuggets or seperate PHP Include Plugins and then make Serendipity output your whole page, and not your page include 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/
-
Guest
Re: Move sidebar items
This worked like a charm - thanks a million!garvinhicking wrote:Code: Select all
<?php chdir('/home/garvin/cvs/serendipity/serendipity_MERGE/'); // This needs to be changed to the path to your blog installation! include_once('serendipity_config.inc.php'); print_r(serendipity_plugin_api::generate_plugins('right', 'div')); ?>
Mikkel