Using Serendipity with Gallery

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Post by Timbalu » Sun May 08, 2005 1:56 pm

Its me again. Hopefully the last time in this thread ;-)

Just to informe you. The stuff I said above is working on my windows computer.
But this one is a working version on my hosters system and I think its even better.
Maybe you still need these changes to functions_smarty.inc.php mentioned above.
I did not prove this version with the original functions_smarty.inc.php file.
Its still just an ugly hack!
Ian


Using Gallery( 1.5 ) inside Serendipity( 0.8 ) with Puretec, 1&1 Hosting.


Append to /gallery/config.php

Code: Select all

$gallery->app->serendipity_dir = "/homepages/xx/dxxxxxxxx/htdocs/serendipity/";



Create & Insert to /gallery/deinit.php

Code: Select all

<?php serendipity_smarty_shutdown($gallery->app->serendipity_dir); ?> 


Since the config directive <<embbed_inside_type>> Garvin mentioned did not work I did this:

Append to /gallery/init.php

Code: Select all

/* --- include serendipity stuff start --- */
$GALLERY_EMBEDDED_INSIDE='Serendipity';
$GALLERY_EMBEDDED_INSIDE_TYPE = 'Serendipity';
/* --- include serendipity stuff end --- */

if (isset($GALLERY_EMBEDDED_INSIDE)) {
   /* Okay, we are embedded */
   switch($GALLERY_EMBEDDED_INSIDE_TYPE) {
      /* --- include serendipity stuff start --- */
      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;          
         /* --- include serendipity stuff end --- */



Since I could not use php_value auto_append_file in my .htaccess file:

Create & Insert to /gallery/php.ini

Code: Select all

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

;max_execution_time = 30     ; Maximum execution time of each script, in seconds
;max_input_time = 60   ; Maximum amount of time each script may spend parsing request data
memory_limit = 100M      ; Maximum amount of memory a script may consume (8MB)

;;;;;;;;;;;;;;;;;
; Data Handling ;
;;;;;;;;;;;;;;;;;

; Automatically add files before or after any PHP document.
;;;;auto_prepend_file =
auto_append_file = "/homepages/xx/dxxxxxxxx/htdocs/gallery/deinit.php"

andy
Regular
Posts: 13
Joined: Mon Apr 25, 2005 6:21 am
Location: FL
Contact:

Gallery instead of s9y Media?

Post by andy » Mon May 09, 2005 5:55 am

Didn't see any posts on this, but has anyone considered using Gallery for the media storage. I know 1.5x isn't the friendliest for this, but what about Gallery2? Or at least offer Gallery as an option in the install?

Seems like it would be a nice fit since it handles multiple levels, formats, users, etc.

-andy

User avatar
RobA
Regular
Posts: 317
Joined: Wed Apr 27, 2005 5:11 pm
Contact:

Post by RobA » Mon May 09, 2005 8:14 pm

Using Timbalu's method above, I've got my gallery http://ffaat.pointclark.net/gallery automatically wrapped by s9y.

The one quirk I've noticed is that setting gallery to embedded with this:

Code: Select all

$gallery->app->embedded_inside_type = "Serendipity"; 
$gallery->app->serendipity_dir = "/home/www/html/s9y/";

causes gallery to not display the login stuff, as it is expecting the app it is embedded in to provide the user management...

Did I miss that somethere? Is there really a way to login still?

I added a gallery login pointing to the gallery/login.php but it works badly, throwing errors and then requiring I click back on the gallery link. I'm guessing because the login screen is intended to be launched as a pop-up...

-Rob A>

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Post by Timbalu » Fri May 13, 2005 3:41 pm

I just discovered why the change of functions_smarty.inc.php mentioned above is no good. You need these functions more then one time.

For this thread I just need to say, that Gallery will work like a charm if you use it with the last mentioned install, without changing functions_smarty.inc.php.

@RobA missing login
change line 217 and 222 in albums.php from
if (!$GALLERY_EMBEDDED_INSIDE) {
to
if ($GALLERY_EMBEDDED_INSIDE) {

This will give you back the login/logout links.
Ian

User avatar
Oliver
Regular
Posts: 178
Joined: Mon Jan 10, 2005 7:43 pm
Location: Herne, Germany
Contact:

Post by Oliver » Mon May 23, 2005 12:48 pm

When trying to include Coppermine, I get the following error:

Kritischer Fehler
There was an error while processing a database query


I edited theme.php:

Code: Select all

<?php
/* SERENDIPITY HOOK START */
    $serendipity_directory = '/is/htdocs/www.forum4winde.de/mods/s9y/';

    $cwd = getcwd();
    chdir($serendipity_directory);
    define('S9Y_INCLUDE_PATH', $serendipity_directory);
    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();
/* SERENDIPITY HOOK END */

/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2005 Coppermine Dev Team
  v1.1 originaly written by Gregory DEMAR

... much more


In template.html I removed everything before <body> and everything after </body> including these tags, too. After that I created a file called deinit.php as said in the third post of this threat and a file .htaccess

deinit.php:

Code: Select all

php_value auto_append_file /is/htdocs/www.forum4winde.de/mods/s9y_cpg133/deinit.php
.

I put these 2 files in my Coppermine-rootdirectory.

When I call my Coppermine-Gallery, the error mentioned above comes up :(

I am using s9y 0.8 (no beta) and CPP v1.3.3 (, using Serendipity with my first and Coppermine with my second database).

What went wrong?

Regards,

Oliver
Image

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking » Mon May 23, 2005 2:05 pm

Seems that coppermine is having a larger problem, as one of its DB queries fails. Don't know what's that about...

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/

User avatar
Oliver
Regular
Posts: 178
Joined: Mon Jan 10, 2005 7:43 pm
Location: Herne, Germany
Contact:

Post by Oliver » Mon May 23, 2005 2:09 pm

Ok, thx Garvin, then I'll create a template for coppermine, so that it looks like my blog :)

[update] I found the error I made: Coppermine does not support separate databases when being includet to another application like s9y, phpBB... CPP and the application, where it should be includet, must use the same database.

Regards,

Olli
Image

User avatar
RobA
Regular
Posts: 317
Joined: Wed Apr 27, 2005 5:11 pm
Contact:

Post by RobA » Tue May 24, 2005 8:50 pm

Timbalu wrote:
@RobA missing login
change line 217 and 222 in albums.php from
if (!$GALLERY_EMBEDDED_INSIDE) {
to
if ($GALLERY_EMBEDDED_INSIDE) {

This will give you back the login/logout links.
Ian


TXS, that works great -

95 percent of the way there...
now the login box is still wrapped in the s9y blog template like so:
Image

I'm guessing this is because of the deinit.php append...
Can that be conditional so it doesn't ocur on the login page?

Thanks,
-Rob A>

Col. Kurtz
Regular
Posts: 450
Joined: Thu May 26, 2005 10:43 am
Location: Bonn, Germany
Contact:

Post by Col. Kurtz » Sun Aug 07, 2005 3:04 pm

OK I´ve just tried this with Serendipity 0.8.1. and Coppermine Photo Gallery 1.3.3. I followed Garvins instructions and I have two problems. First the text I put into theme.php is shown on top of the page. And "Fatal error: Call to undefined function: serendipity_smarty_shutdown() in /www/htdocs/boogada/cm/deinit.php on line 1" is shown on the buttom of the page.

By the way, those two use the same database.

see here:
http://www.hohle-phrasen.de/cm/

what to do? has anyone ever gotten this to work?

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking » Sun Aug 07, 2005 3:31 pm

The Fatal error happens because the s9y framework is not loaded via the prepend directives, or however you want to include it...that function needs to be included, so there seems to be an inclusion issue...

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/

Col. Kurtz
Regular
Posts: 450
Joined: Thu May 26, 2005 10:43 am
Location: Bonn, Germany
Contact:

Post by Col. Kurtz » Sun Aug 07, 2005 9:04 pm

Ok I found the errors I made! I got it to work! Thx.

Only one question left: I had to remove all before the <body> tag in the template.html. This included a java-script:

Code: Select all

<script type="text/javascript" src="scripts.js"></script>


Of course this script wont work anymore now. Does this have to be removed or can I put it back in?

Col. Kurtz
Regular
Posts: 450
Joined: Thu May 26, 2005 10:43 am
Location: Bonn, Germany
Contact:

Post by Col. Kurtz » Sat Aug 27, 2005 1:49 pm

Im still looking for an answer to the javascript question:

There is a script that will open the pictures in a seperate new window in the largest version the pic is available. Usually if the pic is larger than the gallery itself, for example if the pics are 1024x786 or larger. So its a usefull feature that gets disabled. How to keep this script going?

(Maybe I can change this to a simple link with a target=_blank?)
Marc

Guest

Post by Guest » Wed Sep 28, 2005 3:37 pm

I cant find init.php in my gallery2 install folder. Any help here would be appreciated please.

Pat

Embedding vs Wrapping Gallery with Serendipity

Post by Pat » Thu Dec 01, 2005 9:49 pm

I've read the entire thread and I have a different solution to offer:

Instead of trying to embed Gallery in Serendipity and consequently hack up Serendipity's nice code, it is much easier to just wrap the Serendipity skin around Gallery.

2 steps are necessary:
In gallery/html_wrap you will see two files - wrapper.header.default and
wrapper.footer.default

paste the following into wrapper.header default

<body>
<link rel="stylesheet" type="text/css" href="http://yourdomain.com/serendipity.css" />
<div id="serendipity_banner">
<h1>Your Gallery Name Here</h1><BR>

</div>

<table id="mainpane">
<tr>

<td id="serendipityLeftSideBar" valign="top"> <div class="serendipitySideBarItem container_serendipity_html_nugget_plugin">
<h3 class="serendipitySideBarTitle serendipity_html_nugget_plugin">
<ul id="serendipity_categories_list" style="list-style: none; margin: 0px; padding: 0px">
<!-- I use an include to put in a specialized left navigation scheme. You can copy and paste the left column information from the source code, including plugins instead. Make sure you delete the include.-->
<?php include("left.php"); ?>
</div>
</td>
<td id="content" valign="top"><!-- CONTENT START -->

paste the following into wrapper.footer.default

<td id="serendipityRightSideBar" valign="top">
<div class="serendipitySideBarContent">
<CENTER>Welcome to the Gallery</CENTER><BR>
<!-- the welcome to the gallery is in place because I need some text at the top of the right sidebard in order for adsense to work properly. Then I use a simple include statement to show the ads. You can just copy and past the information in the source code for your right sidebar if you like and delete the include-->
<?php include 'ads/ad1.php'; ?>

</div>
</td>
</tr>
</table><TR><TD>
<TABLE width="100%"><TR><TD><CENTER>@copy.Footer Information.</CENTER></TR></TD>
</table>

There are two strenths to this option:
First, you do not hack up Serendipity Code

Second, you get all the gallery titles and headers for your photos
for example, look at the titles that show up for this gallery,

http://ffaat.pointclark.net/gallery/

when you use a variation of the hack provided.

Compare it to the titles shown on my gallery pages

http://greennature.com/gallery/

when you click on animal pictures, for example, the title comes up animal pictures

this is what you want for Search Engine Optimization rather than having your blog name show up on every single page.

I've used this method for 4 different sections of my site, including gallery:

http://greennature.com/travel/
http://greennature.com/dictionary/
http://greennature.com/clipart.php

the only real portion of my site running under gallery is the articles all listed under
http://greennature.com

Hope this helps

:)

Pat

addendum

Post by Pat » Thu Dec 01, 2005 9:59 pm

oops, I meant the only real section of my site running under Serendipity are the articles in the root of the domain.

http://greennature.com/

Post Reply