Using ZenPhoto as a plugin

Hi,

I know this has been discussed before, but I can't get this working...

I would like to use ZenPhoto 1.2.2 as a plugin, I have created a php file with this code:
<?php
define('ZENFOLDER', 'zp-core');
define('WEBPATH', 'zenphoto');
require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php");
?>

When I open this php file on my server I get this error message:
Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/w006b63d/v2/test.php:9) in /www/htdocs/w006b63d/v2/zenphoto/zp-core/functions.php on line 1894

What does it mean?

Comments

  • I have read now, I have to change nearly all of the variables, the code in my new php file looks like this:

    <?php
    define('zenphoto', 'zp-core');
    define('WEBPATH', 'zenphoto');
    require_once(WEBPATH . "/" . zenphoto . "/template-functions.php");
    ?>

    or replace zenphoto with the name of the folder in albums?
    require_once(WEBPATH . "/" . zenphoto . "/template-functions.php");
    ?>
    doesn't work, too

    I still get the same error.
    Zenphoto is installed in zenphoto.
  • Zenphoto is attempting to store a cookie, which is not allowed if `headers` have already been sent. So the most likely cause is that the code you inserted was not placed before the headers for your page. It should be pretty much the first thing in your script.
  • Thank you very much, sbillard, it works now.

    The randon image function is nice, but how do I display the albums from the gallery instead?
    Would you be so nice, to post the code here?
  • There are any number of functions that might be appropriate depending on what you really want. You should check the functions guide on the web site. In particular see the print_album_menu plugin.
  • Sorry, I still don't get it

    my code looks like this:

    <?php
    require_once("zenphoto/zp-core/plugins/print_album_menu.php");
    ?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Unbenanntes Dokument</title>

    </head>

    <body>

    <?php
    printAlbumMenu("list","count","album_menu","album_menu_active","album_menu_sub","album_menu_sub_active");
    ?>

    </body>
    </html>

    I get this error:
    Fatal error: Call to undefined function rewrite_path() in /www/htdocs/w006b63d/v2/zenphoto/zp-core/plugins/print_album_menu.php on line 163
  • What happened to the code of your first post?
  • :) it's gone.

    Maybe, you can just tell me, what the correct code is?

    To use the print-album plugin, I thought I have to enable the plugin in the admin panel/plugins + write down the "require_once" part at the beginning of my php file.
    I link to the print_album_menu.php, not not the template-functions.php like it's written in the first post, is this correct or not?

    The way how to link to the php file with
    "zenphoto/zp-core/plugins/print_album_menu.php"
    or
    "define('ZENFOLDER', 'zp-core'); ... and so on"
    is the same I guess, or not?
  • The code in the example is the basic recipe for using zenphoto from outside the album. It establishes the zenphoto environment. In addition to establishing the environment you need to load any plugins you wish to use.

    See http://www.zenphoto.org/2008/01/hacks/#zenphoto-as-plugin
  • Sorry, but this doesn't help me... maybe you can see in one of my previous posts, that I already know this link (zenphoto-as-plugin).

    I have seen now, someone else has the same problem, at this point excuse me, for opening another thread - I have used the search, but I didn't noticed this thread:
    http://www.zenphoto.org/support/topic.php?id=4742#post-28064

    For me it's the same, I'm not using thickbox, but Highslide JS, which has the same typical lightbox overlay background effect, which looks stupid inside an iframe.

    The other thread from Jahan77 didn't come up with a real solution, it ended up with to look in a album.php from a theme, but this can't be the answer to his second last post.

    How can I contact/send pm's to other members, like Jahan77?
    I have found now function in the forum for it...
  • Click on the `member` link below their name. If they have registered an e-mail address it will show there.
  • No, it's not, maybe just for the admins.
    I just can see:
    Member since + Occupation and the last posts.

    But anyway, can you help me to integrate zenphoto in my site as a plugin to show the albums with thumbs?
  • acrylian Administrator, Developer
    In any case you need to include the template-functions.php file first and then the plugin you want to use. Naturally plugins are depended on the main template-functions.php. That is why you get the error above.
  • thanx acrylian, works.

    With the print_album_menue plugin I can just display links (as a list or drop down menu) to the gallery/gallery albums, but I can't display the gallery like a "mirror" of the zenphoto index.php (with the current theme, thumbs and so on)?
  • At this point you should really have a good thought about what you want to accomplish. If you want your page to look like zenphoto, why not just use zenphoto?
  • I want to use zenphoto, but not on an extra page. I want to integrate the gallery in my existing website, in a div (id="content").
    I don't use Wordpress (not yet), for Wordpress there are several plugins to integrate zenphoto in an existing website/blog, for static html pages there are no plugins.
    I've read "include" for zenphoto doesn't work, to use Ajax for this should have pro and cons, so... I think I need to use iFrames, which seems to be outdated and what you read is, not to use frames for websites, but I don't see any other solution.
  • acrylian Administrator, Developer
    Why don't you just make your theme look like your site. Your visitors will not notice the difference..

    There is a plugin called Zenpage to run a complete site with Zenphoto: http://zenpage.maltem.de
Sign In or Register to comment.