Using Serendipity with Gallery

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

digx, if you get the issue about "function not found" then the Serendipity framework did not got included. Check if your init.php script is working.

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/
efurban
Regular
Posts: 10
Joined: Thu Feb 24, 2005 8:48 am

awesome.

Post by efurban »

fatastic work. I just followed the direction and everything worked like a charm. (am using the cvs version of gallery and s9y)

so now, there is no login and logout link to gallery.
Is there anyway that either using the s9y's authentication ,
or have the links back ?

I'd prefer to use the 1st method.
anybody can give me a direction of how to go about it ?

I am willing to code for it if it's needed.

:)

thanks.
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Post by Timbalu »

I included gallery to 0.7.1, well at least it looks like doing so.

In real live its an included s9y to gallery, but you will not notice leaving s9y.

Have a look at www.waldorfschule-itzehoe.de/wds/
If someone is interested to get an howto I will try to remember... ;-)

Ian
efurban
Regular
Posts: 10
Joined: Thu Feb 24, 2005 8:48 am

yes plz

Post by efurban »

yes, It'll be much appreciated if you can post a how-to. :D

thanks.
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Post by Timbalu »

Hi

Ok! Here is my try. Its working for me, but I would prefer to use the plugin a soon as possible when s9y.0.8 is released!
You´ll need some additional hacks inside the style.css and/or gallery stylesheets.
There has to be a entry link in the nav bar (left or right). You should use the php nugget plugin for this e.g. <a href="/gallery/">gallery</a>


/gallery/html_wraps
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<?php
// $Id: wrapper.header,v 1.01 2004/10/23 18:24:02 ian Exp $
// This header indicates, that Gallery is embedded

if (!preg_match('@/albums_embedded.php$@', $_SERVER['REQUEST_URI'])) {
include('serendipity_embedded.php');
}
?>
<!-- normal header procedure -->

##########################################
/gallery/html_wraps
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<?php # $Id: serendipity_embedded.php,v 1.02 2004/10/23 19:33:32 ian Exp $

define('IS_installed', file_exists($_SERVER['DOCUMENT_ROOT'] . $gallery->app->geeklog_dir . '/s9y/serendipity_config_local.inc.php'));

if ( IS_installed === true ) {
define('IN_serendipity', true);
}

include_once($_SERVER['DOCUMENT_ROOT'] . $gallery->app->geeklog_dir . '/s9y/compat.php');
?>
<div id="serendipity_banner">
<h1>Title</h1>
<h2>Subtitle</h2>
</div>

<table id="mainpane">
<tr>
<td align="left" valign="top">

<!-- plugin sidebar start -->

<table class="embedded_border_bug">
<tr>

<!-- serendipity include start -->

<?php
global $serendipity;
$serendipty['GET']['action'] = 'insidegallery';
/*
* Load DB configuration information
* Load Functions
*/
include_once($_SERVER['DOCUMENT_ROOT'] . $gallery->app->geeklog_dir . '/s9y/serendipity_config_local.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'] . $gallery->app->geeklog_dir . '/s9y/serendipity_functions.inc.php');

/*
* Attempt to connect to the database
*/
if (!serendipity_db_connect()) {
die(DATABASE_ERROR);
}

/*
* Load Configuration options from the database
*/

serendipity_load_configuration();

/*
* Load main language file again, because now we have the preferred language
*/
include($_SERVER['DOCUMENT_ROOT'] . $gallery->app->geeklog_dir . '/s9y/serendipity_lang.inc.php');

if ($serendipity['embed'] && ($serendipity['embed'] === 'true' || $serendipity['embed'] === true)) {
$serendipity['baseURL'] = 'http://' . $_SERVER['HTTP_HOST'] . $serendipity['serendipityHTTPPath'];
}

include_once($_SERVER['DOCUMENT_ROOT'] . $gallery->app->geeklog_dir . '/s9y/serendipity_plugin_api.php');
include_once($_SERVER['DOCUMENT_ROOT'] . $gallery->app->geeklog_dir . '/s9y/serendipity_sidebar_items.php');

if (!$serendipity['embed'] || $serendipity['embed'] === 'false' || $serendipity['embed'] === false) {
serendipity_plugin_api::generate_plugins('left', 'td');
}
?>

<!-- serendipity include end -->

</tr>
</table>

<!-- plugin sidebar end -->

</td>

<td align="left" valign="top" class="embedded_main" cellspacing=0 cellpadding=0>


############################################################
/s9ypath/
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<?php # $Id: layout.php,v 1.03 2004/10/07 10:26:00 ian Exp $

include_once('./serendipity_config.inc.php');
include_once(S9Y_INCLUDE_PATH . 'serendipity_plugin_api.php');
include_once(S9Y_INCLUDE_PATH . 'serendipity_sidebar_items.php');
include_once(S9Y_INCLUDE_PATH . 'embedded_extended_functions.inc.php');
?>
[...]
// show gallery page
case "gallery":
serendipity_printGallery();
break;

############################################################
/s9ypath/
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<?php # $Id: embedded_extended_entries.inc.php,v 1.02 2004/12/04 13:52:00 ian Exp $

[...]
else if (preg_match('@/gallery$@', $uri)) {
header('Content-Type: text/html; charset=ISO-8859-1');
$serendipity['GET']['action'] = 'gallery';

/* while we need the session var to enable or disable them, we have to start the */
session_start();

/* which makes the use of ob_start(); - include page -
* than ob_get_contents(); and ob_end_flush(); obsolet. */
include_once('serendipity_genpage.inc.php');
}

############################################################
/s9ypath/
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<?php # $Id: embedded_extended_functions.inc.php,v 1.01 2004/10/07 10:26:00 ian Exp $

if($serendipty['GET']['action'] == 'insidegallery') {
include_once("/home/www/your/dirs/to/s9y/serendipity_db.inc.php");
include_once("/home/www/your/dirs/to/s9y/compat.php");
include_once("/home/www/your/dirs/to/s9y/serendipity_functions_config.inc.php");
include_once("/home/www/your/dirs/to/s9y/bundled-libs/XML/RPC.php");
include_once("/home/www/your/dirs/to/s9y/serendipity_plugin_api.php");
include_once("/home/www/your/dirs/to/s9y/serendipity_functions_images.inc.php");
include_once("/home/www/your/dirs/to/s9y/serendipity_functions_installer.inc.php");
}

[...]
function serendipity_printGallery() {
global $serendipity;
$serendipity['GET']['showgallery'] = false;

## close forgetten $_SESSION vars, but !!! ATTENTION !!! not the active SESSION VAR!
unset($_SESSION['.....']);

## include gallery page
include_once '/home/www/your/dirs/to/gallery/albums.php';

}


######################################################################################################
/s9ypath/
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<?php # $Id: serendipity_functions.inc.php,v 1.454.2.1 2004/11/09 19:10:56 garvinhicking Exp $
# Copyright (c) 2003-2004, Jannis Hermanns
# All rights reserved. See LICENSE file for licensing details

/* need to include this, while using gallery script */
if (!defined('S9Y_INCLUDE_PATH')) {
define('S9Y_INCLUDE_PATH', dirname(__FILE__) . '/');
}

#####################################################################################################
/s9ypath/
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<?php # $Id: serendipity_genpage.inc.php,v 1.35 2004/10/14 11:41:14 jhermanns Exp $

[...]
<html>
<head>
<title><?php echo htmlspecialchars($serendipity['blogTitle']) . (isset($serendipity['blogSubTitle']) ? ' - '. htmlspecialchars($serendipity['blogSubTitle']) : '') ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo LANG_CHARSET; ?>" />
<meta name="Powered-By" content="Serendipity v.<?php echo $serendipity['version'] ?>" />
<?php
$bdir = '';
if($serendipity['GET']['action'] == 'gallery') {
$GALLERY_EMBEDDED_INSIDE = 's9y';
$bdir = ' dir="ltr"';
include_once '/home/www/your/dirs/to/gallery/config.php';
}
?>
<link rel="stylesheet" type="text/css" href="<?php echo $serendipity['serendipityHTTPPath']; ?>serendipity.css.php" />

Well, I am not shure about this if() phrase, give it a try!
###################################################################################################
/gallery/
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* $Id: albums.php,v 1.156.2.5 2004/08/20 06:03:16 cryptographite Exp $
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* $Id: slideshow.php Exp $
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* $Id: view_album.php Exp $
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* $Id: view_photo.php Exp $
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[...]
/*
** when direction is ltr(left to right) everything is fine)
** when rtl(right to left), like in hebrew, we have to switch the alignment at some places.
*/
if ($gallery->direction == 'ltr') {
$left="left";
$right="right";
}
else {
$left="right";
$right="left";
}
//////////////////////////////////////// s9y import start////////////////////////////////
/* URI paths
* These could be defined in the language headers, except that would break
* backwards URL compatibility
*/
@define('PATH_ARCHIVES', 'archives');
@define('PATH_ARCHIVE', 'archive');
@define('PATH_UNSUBSCRIBE', 'unsubscribe');
@define('PATH_DELETE', 'delete');
@define('PATH_APPROVE', 'approve');
@define('PATH_FEEDS', 'feeds');
@define('PATH_ADMIN', 'admin');
@define('PATH_ENTRIES', 'entries');
@define('PATH_CATEGORIES', 'categories');
@define('PATH_PLUGIN', 'plugin');

/* URI patterns
* Note that it's important to use @ as the pattern delimiter. DO NOT use shortcuts
* like \d or \s, since mod_rewrite will use the regexps as well and chokes on them.
*/
@define('PAT_FILENAME', '0-9a-z\.\_!;,\+\-');
@define('PAT_UNSUBSCRIBE', '@/'.PATH_UNSUBSCRIBE.'/(.*)/([0-9]+)@');
@define('PAT_APPROVE', '@/'.PATH_APPROVE.'/(.*)/(.*)/([0-9]+)@');
@define('PAT_DELETE', '@/'.PATH_DELETE.'/(.*)/(.*)/([0-9]+)@');
@define('PAT_ARCHIVES', '@/'.PATH_ARCHIVES.'/([0-9]+)\.html@');
@define('PAT_ARCHIVES_SHORT', '@/'.PATH_ARCHIVES.'/([0-9]+)[_\-]short\.html@');
@define('PAT_COMMENTSUB', '@/([0-9]+)[_\-][' . PAT_FILENAME . ']*\.html@i');
@define('PAT_FEEDS', '@/'.PATH_FEEDS.'/@');
@define('PAT_FEED', '@/(index|atom|rss|b2rss|b2rdf).(rss|rdf|rss2|xml)$@');
@define('PAT_ADMIN', '@/'.PATH_ADMIN.'$@');
@define('PAT_ENTRIES', '@/'.PATH_ENTRIES.'$@');
@define('PAT_ARCHIVE', '@/'.PATH_ARCHIVE.'$@');
@define('PAT_CATEGORIES', '@/'.PATH_CATEGORIES.'/([0-9]+)@');
@define('PAT_PLUGIN', '@/' . PATH_PLUGIN . '/(.*)@');

@define('USERLEVEL_ADMIN', 255);
@define('USERLEVEL_CHIEF', 1);
@define('USERLEVEL_EDITOR', 0);

@define('VIEWMODE_THREADED', 'threaded');
@define('VIEWMODE_LINEAR', 'linear');

if (!$GALLERY_EMBEDDED_INSIDE) {
doctype();
?>
<html>
<head>
<title><?php echo $gallery->app->galleryTitle ?></title>
<?php
common_header(); /* calls embedded_style.css in skin/_*_/css folder */
echo "\n"; /* wrap line to next link */

/* prefetching/navigation */
if ($navigator['page'] > 1) { ?>
<link rel="top" href="<?php echo makeGalleryUrl('albums.php', array('set_albumListPage' => 1)) ?>" />
<link rel="first" href="<?php echo makeGalleryUrl('albums.php', array('set_albumListPage' => 1)) ?>" />
<link rel="prev" href="<?php echo makeGalleryUrl('albums.php', array('set_albumListPage' => $navigator['page']-1)) ?>" />
<?php }
if ($navigator['page'] < $maxPages) { ?>
<link rel="next" href="<?php echo makeGalleryUrl('albums.php', array('set_albumListPage' => $navigator['page']+1)) ?>" />
<link rel="last" href="<?php echo makeGalleryUrl('albums.php', array('set_albumListPage' => $maxPages)) ?>" />
<?php } ?>
<link rel="stylesheet" type="text/css" href="/s9y/serendipity.css.php" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/s9y/feeds/index.rss2" />
<link rel="alternate" type="application/x.atom+xml" title="Atom" href="/s9y/feeds/atom.xml" />
///////// s9y import end ////////////////////////////////////////////////////////
<?php
if (strtolower($serendipity['extCSS'])!='') {
?>


##############################################################################################
/gallery/
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* $Id: util.php,v 1.410.2.9 2004/08/23 00:41:43 cryptographite Exp $

[...]
function doctype() {
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
echo "\n\n";
}

function common_header() {

// Do some meta tags
metatags();

// Import CSS Style_sheet
echo getStyleSheetLink();
}

function metatags() {
global $gallery;

#echo '<meta http-equiv="content-style-type" content="text/css">';
echo "\n ". '<meta http-equiv="content-style-type" content="text/css">';
echo "\n ". '<meta http-equiv="content-type" content="Mime-Type; charset='. $gallery->charset .'">';
echo "\n ". '<meta name="content-language" content="' . str_replace ("_","-",$gallery->language) . '">';
echo "\n\n";
}
mattcave
Regular
Posts: 5
Joined: Thu Mar 03, 2005 8:52 am

Re: awesome.

Post by mattcave »

efurban wrote: so now, there is no login and logout link to gallery.
Is there anyway that either using the s9y's authentication ,
or have the links back ?
I've just tried this and have the same problem. Does anyone know what the solution is? I'm guessing it's down to the fact that I'm logged in as "Matt" in Serendipity and the only admin user within Gallery is called "admin", hence it doesn't show me the administrative features within Gallery.
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

time is running

Post by Timbalu »

Hi Romulus and Garvin

How the hell did you (Romulus) hack this 0.8 into gallery on your site. I installed s9y 0.8 and Gallery 1.5 and made all the suggestions Garvin told one page back, but I always get a Fatal error: Call to a member function on a non-object in /home/path/html/s9y/include/functions_smarty.inc.php on line 236

Is there a solution?
Ian
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: time is running

Post by garvinhicking »

Ian:

Your problem is that your gallery does not call the prepend script which calls serendipity_smarty_init(). Look up my howto to see how the prepend script needs to be called.

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/
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: time is running

Post by Timbalu »

garvinhicking wrote:Your problem is that your gallery does not call the prepend script which calls serendipity_smarty_init().
Hi Garvin,
Its not the deinit.php, I think. I tried to call it direct inside albums.php or index.php.
It must be the switch call which is not being called, because Gallery is on its way but no s9y siteBar...
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: time is running

Post by garvinhicking »

Timbalu,

I was not talking of deinit.php. I was talking of the init script/file.

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/
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: time is running

Post by Timbalu »

garvinhicking wrote:... I was talking of the init script/file.
me too, Garvin!

if (isset($GALLERY_EMBEDDED_INSIDE)) {
/* Okay, we are embedded */
switch($GALLERY_EMBEDDED_INSIDE_TYPE) {
case 'more to come here':
case 'Serendipity':
include(dirname(__FILE__) . "/classes/gallery/UserDB.php");
include(dirname(__FILE__) . "/classes/gallery/User.php");
....etc.

I put the Serendipity section just right after mambo and before geeklog.
The config geeklog var is set to nothing, even with some/path or case:Serendipity after case:geeklog its not working. :(

any ideas left?
maybe s9y or gallery have to be set embedded...?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: time is running

Post by garvinhicking »

Hm, this case "more to come here" irritates me, it was not in my Gallery installation I tried the embedding with.

Maybe the version of Gallery has changed their inclusion means.

You'll need to debug whether or not the serendipity_smarty_init() function is called, and why not. In any case it's a matter of the gallery script/inclusion, serendipity has not yet been touched correctly.

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/
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: time is running

Post by Timbalu »

garvinhicking wrote:Hm, this case "more to come here" irritates me, it was not in my Gallery installation I tried the embedding with.
this is what I meant, sorry!
case 'postnuke':
case 'phpnuke':
case 'nsnnuke':
case 'phpBB2':
case 'mambo':
case 'Serendipity':
case 'GeekLog':
case 'cpgnuke':
garvinhicking wrote:You'll need to debug whether or not the serendipity_smarty_init() function is called, and why not. In any case it's a matter of the gallery script/inclusion, serendipity has not yet been touched correctly.
Yes Garvin, that´s the problem and I am out to get a solution ... :?
It is not a question of being embedded?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: time is running

Post by garvinhicking »

Timbalu:

No, the "embed" mechanism is not used/needed. In fact, using Smarty, the whole embed structure of Serendipity is really not needed anymore since you can do everything you need via the Smarty Templating.

And you would only need embedding if you wanted to show Serendipity within Gallery. But you want to do it the other way round, so only Gallery needs to be embedded.

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/
Guest

Re: time is running

Post by Guest »

garvinhicking wrote:Timbalu:

No, the "embed" mechanism is not used/needed. In fact, using Smarty, the whole embed structure of Serendipity is really not needed anymore since you can do everything you need via the Smarty Templating.
Regards,
Garvin
Now I am completely confused.

I'm using s9y 0.8 (downloaded from the main page link http://prdownloads.sourceforge.net/php- ... z?download) and Gallery v1.4.4-pl6.

Followed the suggestion in the first post of this thread (wrapping gallery with s9y...I think), and see nothing happening.... I go to www.myurl.com/gallery and see....my gallery, just like it always looked...

Is this the correct method for the versions I have...or do I need to follow the Smarty Templating method covered later in the thread...

-A puzzled noob.
Post Reply