Usually, one would embed gallery into Serendipity; but this causes some trouble with all the URLs and would affect many files to be edited.
Thus I used a way to let Gallery include the Serendipity framework.
1. You need at least Serendipity 0.8-alpha3 for this method to work. This development version uses Smarty and makes it easier to include foreign content.
2. Install Gallery
3. Install Serendipity
4. Edit your "config.php" file of the Gallery installation. Set those variables:
Code: Select all
$gallery->app->embedded_inside_type = "Serendipity";
$gallery->app->serendipity_dir = "/your/path/to/serendipity/";
Code: Select all
/* Okay, we are embedded */
switch($GALLERY_EMBEDDED_INSIDE_TYPE) {
Code: Select all
case 'Serendipity':
include(dirname(__FILE__) . "/classes/gallery/UserDB.php");
include(dirname(__FILE__) . "/classes/gallery/User.php");
/* Load our user database (and user object) */
$gallery->userDB = new Gallery_UserDB;
/* Load their user object with their username as the key */
if (isset($gallery->session->username) && !empty($gallery->session->username)) {
$gallery->user = $gallery->userDB->getUserByUsername($gallery->session->username);
}
$serendipity_directory = $gallery->app->serendipity_dir;
$cwd = getcwd();
chdir($gallery->app->serendipity_dir);
define('S9Y_INCLUDE_PATH', $gallery->app->serendipity_dir);
include_once(S9Y_INCLUDE_PATH . 'serendipity_config.inc.php');
include_once(S9Y_INCLUDE_PATH . 'include/functions.inc.php');
include_once(S9Y_INCLUDE_PATH . 'include/plugin_api.inc.php');
include_once(S9Y_INCLUDE_PATH . 'include/plugin_internal.inc.php');
$serendipity['smarty_file'] = 'index.tpl';
$serendipity['smarty_raw_mode'] = false;
serendipity_smarty_init();
$serendipity['smarty']->assign(
array(
'leftSidebarElements' => serendipity_plugin_api::count_plugins('left'),
'rightSidebarElements' => serendipity_plugin_api::count_plugins('right')
)
);
chdir($cwd);
ob_start();
break;
Code: Select all
<?php serendipity_smarty_shutdown($gallery->app->serendipity_dir); ?>
Code: Select all
php_value auto_append_file /full/path/to/gallery/deinit.php
Steps 4 and 5 may become part of the official Gallery distribution once Serendipity 0.8 will be out.
I have only tested basic functionality; there may still be parts not working perfectly. Feedback appreciated!