Embed ZenPhoto into my current website

Just found ZenPhoto yesterday. works great stand alone.

The default theme is perfect look and feel for what I'm doing; question is how to implement into my current site.

what files do I use to code my HTML. album.php image.php index.php functions.php template-functions.php????????????

Basically want my Logo, Nav bars, footer....etc.... surrounding Zenphoto -- simple straight forward nothing fancy.

If I could get pointed in the right direction ...so i know where to start.

Thanks So Much

Comments

  • Thank you for the direction; but got this error....though zenphoto placed the random image
    perfectly on page but with this error above it.

    Warning: Cannot modify header information - headers already sent by (output started at /home/content/p/a/r/parts/html/fencing/index_zenphoto1.php:6) in /home/content/p/a/r/parts/html/fencing/zenphoto/zp-core/functions.php on line 1803

    I actually used the plugin method like so; Basically placing in the middle of my webpage using a basic table.

    index.php

    <table border="0" cellspacing="0" cellpadding="0">
    <tr><td >
    <?php
    define('ZENFOLDER', 'zp-core');
    define('WEBPATH', 'zenphoto');
    require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php");

    $randomImage = getRandomImages();
    $randomImageURL = getURL($randomImage);
    echo "
    <img src='". $randomImage->getSizedImage(getOption('image_size')) . "'
    alt=\"random image\"\n" . $randomImage->getTitle() . '" />
    ';
    ?>
    </td>
    </tr>
    </table>
  • You will have to place the zenphoto connection code before you have sent any HTML output.
  • Thanks so much again.....

    are you speaking of function-db.php? DataBase Connection?

    where can I find the zenphoto connection code.
  • `
    define('ZENFOLDER', 'zp-core');
    define('WEBPATH', 'zenphoto');
    require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php");
    `
    and any plugin connections you need made must all be done before your script makes any output.
  • Works Perfect!! - rather than displaying a Random Image

    Is it possible to embed the index.php for the theme or album this way? So the album index is displayed within the page?

    or would I lose the page look as soon as the link is clicked?

    If so creating a new theme might be my only way.

    I'm actually trying to avoid creating a new theme that matches my site....I like the Plugin method but not sure how to implement to all pages in zenphoto....( default theme..index.php, album.php, image.php)

    Thanks again.......you guys are great
  • acrylian Administrator, Developer
    No, it is not possible to incldue Zenphoto itself that way. The link I posted above has all methods that can be used.

    Except you want to do a lot of work to set up the Zenphoto environment for the page (index, album, image) correctly "manually". Then a theme would probably be much easier..;-)

    I believe others have achieved this by using an iFrame but that is not a really elegant solution.
  • Ok...got it
    All I had to do is take the Default Theme code(index.php, album.php, and image.php) and rewrite it into my code and PERFECT
    Page.

    Had to go back a few times to re-write some paths...but works as I imagined

    Thanks so much...what a great help
  • I'm trying to do about the same thing. I want Zenphoto to work within my current site, which has a header, left sidebar and a footer. Would you be able to show me how you did this, which code you used in the end? Do you also have a link to the gallery where this is used? Greatful for any advice. I'm guessing it's this website you are talking about?
    http://mercerfencing.com/zenphoto/
  • acrylian Administrator, Developer
    Please see here: http://www.zenphoto.org/2009/03/troubleshooting-zenphoto/#32
    The "plugin way" is for example what we use on zenphoto.org. But in any case you will have to do some work.
  • Ah, yes i did read that. And i know it will take work whichever path i choose. It seems like "kmbroker" found an easy solution, I don't know any php, so I just need a pointer to get started. I do know xhtml and css.
  • I tried an embed-o-rator found here:
    http://www.flashyourweb.com/staticpages/index.php?page=gallery2_embed-o-rator
    It's made for Gallery2. Is there a similar tool for Zen?
    I tried the function, but it did not work, I guess because the 2nd line, the embed.php file is missing.

    <?php
    require_once ('http://www.alternativephotography.com/photography/embed.php');
    $ret = GalleryEmbed::init( array ('g2Uri'=>'http://www.alternativephotography.com/photography/index.phpmain.php', 'embedUri'=>'http://www.alternativephotography.com/photography/artists.php', 'fullInit'=>'false'));
    if ($ret) {
    print 'G2 init error: '.$ret->getAsHtml();
    }
    $g2data = GalleryEmbed::handleRequest();
    if ($g2data['isDone']) {
    exit;
    }
    GalleryEmbed::done();
    ?>
    <!-- Your Html Head -->
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <title>Photographers</title>
    <link href="http://www.alternativephotography.com/common/ap_style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="http://www.alternativephotography.com/common/script.js"></script>
    <!-- Gallery's Head -->
    <?php
    echo $g2data['headHtml'];
    ?>
    <!-- End Gallery's Head -->
    </head>
    <!-- End Your Html Head -->
    <!-- Your Html Body -->
    <body>
    <p>Header here in this space</p>
    <!-- End Your Html Body -->
    <!-- Gallery's Body -->
    <?php
    echo $g2data['bodyHtml'];
    ?>
    <!-- End Gallery's Body -->
    <!-- Your Html Footer -->
    <p>Footer here in this space</p>
    </body>
    </html>
    <!-- End Your Html Footer -->

    The Gallery2 embed file looks like this:
    <?php
    /* Define G2_EMBED = 1 to remember to generate correct URLs and return the HTML, etc. */
    require_once(dirname(__FILE__) . '/modules/core/classes/GalleryDataCache.class');
    GalleryDataCache::put('G2_EMBED', 1, true);
    require(dirname(__FILE__) . '/main.php');
    require(dirname(__FILE__) . '/modules/core/classes/GalleryEmbed.class');

    GalleryEmbed::getEmbedPathByHttpRequest();
    ?>

    I know absolutely no php, so i have no idea how to make it work, but perhaps it could be useful for some other of you.
  • acrylian Administrator, Developer
    You did not read the link I posted above, did you? The "zenphoto as a plugin" way is similiar.
  • I did, but i understand about a third of it. Sorry, it must be boring dealing with php-zeros like me on this forum! :-)
    The first sentence raises more questions to me than it answers:
    "You can use zenphoto features in your main web pages by including template-functions.php in your php pages. To do this successfully when the page is not in the zenphoto folders include the following PHP code in you page..."
    -Do i create a page called template-function.php? I can't find it anywhere in the folders.
    -Where do i insert the php? in the template-function.php page? In a new page on my website, should the page be php or html?
  • acrylian Administrator, Developer
    Right below that first sentence is a code example what to do...
    The page to do that on is of course the page where you want to use Zenphoto functions...for php naturally a php page.

    I strongly suggest to learn a few more basics before trying this. Sorry if that sounds too harsh. No problem with "php-zeros" in general, I was one once, too. But you will understand that this forum is really not the place to learn and teach general web techniques.
  • This post helped me integrate zenphoto into my site, thanks so much!!
Sign In or Register to comment.