zenphoto forums » General Zenphoto Discussion

Integrating ZenPhoto in Wordpress

(44 posts)

Tags:

  1. spellmank

    Member
    Joined: May '06
    Posts: 20

    Hi,

    What is the best method to integrate ZenPhoto within WordPress? I've looked into ZenPress (http://simbul.bzaar.net/zenpress/), but it appears that it only allows for linking to one's separate ZenPhoto site. I like the way A day in the life... site (http://www.chilifrei.net) has integrated ZenPhoto in such a way that it looks like the rest of the site. Any assistance would be greatly appreciated.

    Thanks,
    spellmank

    Posted 11 years ago #
  2. Chilifrei64

    Contributor
    Joined: Dec '05
    Posts: 541

    Put the following information in your zproot/index.php

    /* Start Wordpress */
    define('WP_USE_THEMES', false);
    require($_SERVER["DOCUMENT_ROOT"].'/journal/wp-blog-header.php');
    /* Start zenphoto */
    require_once("zen/template-functions.php");
    $themepath = 'themes';
    $theme = $_zp_gallery->getCurrentTheme();
    $_zp_themeroot = WEBPATH . "/$themepath/$theme";
    if (in_context(ZP_IMAGE)) {
    include("$themepath/$theme/image.php");
    } else if (in_context(ZP_ALBUM)) {
    include("$themepath/$theme/album.php");
    } else if (in_context(ZP_INDEX)) {
    include("$themepath/$theme/index.php");
    }

    3. Tweak your zenphoto templates (not your wp templates) to fit your wp style. You can now use functions such as get_header and get_sidebar.
    4. Work around a conflict with comments by opening the ZP template image.php and replacing isset($error) with $FIXME.

    A couple of things to look for

    if you are calling your wordpress
    getheader();
    or
    getsidebar();
    That can cause problems depending on where it is placed.
    make sure your
    require_once('zen/template-functions.php');
    is before your getheader() or getsidebar() calls and right after your require(..wp-blog-header.php) call

    The other thing that I did because of conflicting css styles was I removed the zenphoto css file from the templates and merged it into my wordpress theme css file. This made integrating much easier.

    PS.. I wasnt trying to be a jerk on my board.. sorry if I came across that way, I thought you were asking questions about zenpress which I dont know much about other than I have it installed and it works for me.

    Posted 11 years ago #
  3. spellmank

    Member
    Joined: May '06
    Posts: 20

    I didn't think you were being a jerk at all. Sorry that you thought I thought that. : -)

    Thanks for the instructions above. I'll give them a try.

    spellmank

    Posted 11 years ago #
  4. spellmank

    Member
    Joined: May '06
    Posts: 20

    I hate to appear dim, but I'm not finding require_once('zen/template-functions.php'); or require(..wp-blog-header.php) in any of my theme/default files or zen/ files for that matter. Not sure how to edit those theme/default files if I can't find the "calls" you mentioned above. I'm very new to PHP so some I am a bit lost.

    However, I was able to edit the zproot/index.php and the image.php files successfully. I'm holding off on the css edits until I figure out how to edit the ZP templates.

    spellmank

    Posted 11 years ago #
  5. Chilifrei64

    Contributor
    Joined: Dec '05
    Posts: 541

    All files that you edit are going to be zenphoto files.

    the require_once('zen/template-functions.php'); is located in your zenphoto root This is the file(really the only file) that you need to edit. NOT the index.php in your themes directory.
    example:(my website) http://www.chilifrei.net/zp
    is the url to my gallery. On my hard drive the path is d:\websites\chilifrei.net\zp
    inside that zp folder is an index.php which is the file you need to edit.

    Posted 11 years ago #
  6. spellmank

    Member
    Joined: May '06
    Posts: 20

    I'm getting this fatal error:

    Fatal error: Cannot redeclare is_valid_email() (previously declared in /var/www/vhosts/karaspellman.com/httpdocs/wordpress/zenphoto/zen/functions.php:88) in /var/www/vhosts/karaspellman.com/httpdocs/wordpress/wp-content/plugins/email/email.php on line 270

    Any thoughts?

    Posted 11 years ago #
  7. Chilifrei64

    Contributor
    Joined: Dec '05
    Posts: 541

    Did you do this fix?

    4. Work around a conflict with comments by opening the ZP template image.php and replacing isset($error) with $FIXME.

    Posted 11 years ago #
  8. spellmank

    Member
    Joined: May '06
    Posts: 20

    I had already done that. I replaced iseet($error) which looked like this (isset($error)) with this ($FIXME).

    Posted 11 years ago #
  9. Chilifrei64

    Contributor
    Joined: Dec '05
    Posts: 541

    copy and paste your zproot/index.php into here so I can see..

    also, do you have a link we can look at?

    Posted 11 years ago #
  10. Zenphoto development team
    trisweb

    Zenphoto team
    Joined: Sep '05
    Posts: 1,852

    It's a conflict in the function name since I copied that function from WP ;-) Just rename it and its one use in Zenphoto and it should work. Sorry about that, how bout if I rename the function for the next release?

    Posted 11 years ago #
  11. spellmank

    Member
    Joined: May '06
    Posts: 20

    trisweb,

    Ahhh, so I shoul rename isset($error) something like $Oops?
    Sorry, don't quite follow you. I don't know enough about PHP yet.

    spellmank

    Posted 11 years ago #
  12. spellmank

    Member
    Joined: May '06
    Posts: 20

    <?php
    /* Original Code */
    require_once("zen/template-functions.php");
    $themepath = 'themes';

    $theme = $_zp_gallery->getCurrentTheme();

    $_zp_themeroot = WEBPATH . "/$themepath/$theme";

    if (in_context(ZP_IMAGE)) {
    include("$themepath/$theme/image.php");
    } else if (in_context(ZP_ALBUM)) {
    include("$themepath/$theme/album.php");
    } else if (in_context(ZP_INDEX)) {
    include("$themepath/$theme/index.php");
    }

    /* Start Wordpress */
    define('WP_USE_THEMES', false);
    require($_SERVER["DOCUMENT_ROOT"].'/wordpress/wp-blog-header.php');
    /* Start zenphoto */
    require_once("zen/template-functions.php");
    getheader();
    getsidebar();
    $themepath = 'themes';
    $theme = $_zp_gallery->getCurrentTheme();
    $_zp_themeroot = WEBPATH . "/$themepath/$theme";
    if (in_context(ZP_IMAGE)) {
    include("$themepath/$theme/image.php");
    } else if (in_context(ZP_ALBUM)) {
    include("$themepath/$theme/album.php");
    } else if (in_context(ZP_INDEX)) {
    include("$themepath/$theme/index.php");
    }

    ?>

    Link: http://www.karaspellman.com/wordpress/zenphoto/

    Posted 11 years ago #
  13. Chilifrei64

    Contributor
    Joined: Dec '05
    Posts: 541

    I am sorry, I made a grammitical error.. dont put the code above into your index.php.. replace the old code with the code above.

    you should only have your second part.. it looks as if you have both the original code and the new code live and between php brackets? your zproot/index.php should look like this

    <?php
    /* Start Wordpress */
    define('WP_USE_THEMES', false);
    require('../wp-blog-header.php');
    require_once("zen/template-functions.php");
    //Get Header */
    get_header();
    //Get Sidebar
    get_sidebar();
    /* Start zenphoto */
    $themepath = 'themes';
    $theme = $_zp_gallery->getCurrentTheme();
    $_zp_themeroot = WEBPATH . "/$themepath/$theme";
    if (in_context(ZP_IMAGE)) {
    include("$themepath/$theme/image.php");
    } else if (in_context(ZP_ALBUM)) {
    include("$themepath/$theme/album.php");
    } else if (in_context(ZP_INDEX)) {
    include("$themepath/$theme/index.php");
    }
    //Get Footer
    get_footer();
    ?>

    Posted 11 years ago #
  14. spellmank

    Member
    Joined: May '06
    Posts: 20

    Hi,

    I'm still getting that email error after making the changes to the index.php file above. Here is my code for the image.php from the default theme. Again I had changed isset($error) to ($FIXME). Should it be just $FIXME instead of ($FIXME)?

    <?php if (!defined('WEBPATH')) die(); ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
    <head>
    <title><?php printGalleryTitle(); ?> | <?php echo getAlbumTitle();?> | <?php echo getImageTitle();?></title>
    <link rel="stylesheet" href="<?php echo $_zp_themeroot ?>/zen.css" type="text/css" />
    <script type="text/javascript">
    function toggleComments() {
    var commentDiv = document.getElementById("comments");
    if (commentDiv.style.display == "block") {
    commentDiv.style.display = "none";
    } else {
    commentDiv.style.display = "block";
    }
    }
    </script>
    <?php zenJavascript(); ?>
    </head>

    <body>

    <div id="main">

    <div class="imgnav">
    <?php if (hasPrevImage()) { ?>
    <div class="imgprevious">" title="Previous Image">« prev</div>
    <?php } if (hasNextImage()) { ?>
    <div class="imgnext">" title="Next Image">next »</div>
    <?php } ?>
    </div>

    <div id="gallerytitle">
    <h2><span>" title="Gallery Index"><?php echo getGalleryTitle();?>
    | " title="Gallery Index"><?php echo getAlbumTitle();?>
    | </span> <?php printImageTitle(true); ?></h2>
    </div>

    <div id="image">
    " title="<?php echo getImageTitle();?>"> <?php printDefaultSizedImage(getImageTitle()); ?>
    </div>

    <div id="narrow">

    <?php printImageDesc(true); ?>

    <div id="comments">
    <?php $num = getCommentCount(); echo ($num == 0) ? "" : ("<h3>Comments ($num)</h3>"); ?>
    <?php while (next_comment()): ?>
    <div class="comment">
    <div class="commentmeta">
    <span class="commentauthor"><?php printCommentAuthorLink(); ?></span> says:
    </div>
    <div class="commentbody">
    <?php echo getCommentBody();?>
    </div>
    <div class="commentdate">
    <?php echo getCommentDate();?>
    ,
    <?php echo getCommentTime();?>
    <?php printEditCommentLink('Edit', ' | ', ''); ?>
    </div>
    </div>
    <?php endwhile; ?>
    <div class="imgcommentform">
    <!-- If comments are on for this image AND album... -->
    <h3>Add a comment:</h3>
    <form id="commentform" action="#" method="post">
    <div><input type="hidden" name="comment" value="1" />
    <input type="hidden" name="remember" value="1" />
    <?php if ($FIXME) { ?><tr><td><div class="error">There was an error submitting your comment. Name, a valid e-mail address, and a comment are required.</div></td></tr><?php } ?>

    <table border="0">
    <tr>
    <td><label for="name">Name:</label></td>
    <td><input type="text" id="name" name="name" size="20" value="<?php echo $stored[0];?>" class="inputbox" />
    </td>
    </tr>
    <tr>
    <td><label for="email">E-Mail:</label></td>
    <td><input type="text" id="email" name="email" size="20" value="<?php echo $stored[1];?>" class="inputbox" />
    </td>
    </tr>
    <tr>
    <td><label for="website">Site:</label></td>
    <td><input type="text" id="website" name="website" size="40" value="<?php echo $stored[2];?>" class="inputbox" /></td>
    </tr>

    </table>
    <textarea name="comment" rows="6" cols="40"></textarea>

    <input type="submit" value="Add Comment" class="pushbutton" /></div>
    </form>
    </div>
    </div>
    </div>
    </div>

    <div id="credit"><?php printAdminLink('Admin', '', ' | '); ?>Powered by zenphoto</div>
    </body>
    </html>

    Posted 11 years ago #
  15. spellmank

    Member
    Joined: May '06
    Posts: 20

    Here is that email error again:

    Fatal error: Cannot redeclare is_valid_email() (previously declared in /var/www/vhosts/karaspellman.com/httpdocs/wordpress/wp-content/plugins/email/email.php:270) in /var/www/vhosts/karaspellman.com/httpdocs/wordpress/zenphoto/zen/functions.php on line 88

    I took a look at line 88 in the ZenPhoto functions.php and it is this:

    // Determines if the input is an e-mail address. Stolen from WordPress, then fixed.
    function is_valid_email($input_email) {
    $chars = "/^([a-z0-9+_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,6}\$/i";
    if(strstr($input_email, '@') && strstr($input_email, '.')) {
    if (preg_match($chars, $input_email)) {
    return true;
    }
    }
    return false;
    }

    I also looked at line 270 from email.php in WordPress:

    ### Function: Check Valid E-Mail Address
    function is_valid_email($email) {
    $regex = '/^[A-z0-9][\w.-]*@[A-z0-9][\w\-\.]+\.[A-z0-9]{2,6}$/';
    return (preg_match($regex, $email));
    }

    Posted 11 years ago #
  16. Zenphoto development team
    trisweb

    Zenphoto team
    Joined: Sep '05
    Posts: 1,852

    I told you above, you have to rename is_valid_email in zenphoto. It will not work without doing that. Just replace the string "is_valid_email" anywhere it's found in ZP code to "is_valid_email_zp"

    It's changed in the latest SVN if you just want to use that...

    Posted 11 years ago #
  17. spellmank

    Member
    Joined: May '06
    Posts: 20

    Sorry, trisweb,

    I'm new to PHP so I don't always follow what has been said above. When you said to rename a function I wasn't sure which one. I just needed more specifics.

    Thanks again for your help!
    spellmank

    Posted 11 years ago #
  18. ruzee

    Apprentice
    Joined: Jun '06
    Posts: 1

    Here's another way of doing it (including a nice howto):
    http://www.ruzee.com/blog/2006/06/integrating-zenphoto-into-wordpress/

    Posted 11 years ago #
  19. webdev

    Member
    Joined: Feb '06
    Posts: 36

    thnx ruzee !

    Posted 10 years ago #
  20. ny888

    Member
    Joined: Jul '06
    Posts: 31

    I'm so close to getting this all to work I can taste it but need some clarification -

    I've modified index.php so now it displays with my header, sidebar, and footer.

    Only thing is that the zp content is not fitting inside of the blog alongside the sidebar. Instead, it's displaying below the sidebar and is taking up the width of the page.

    I must be missing edits ??? in index.php, album.php and image.php ??

    Posted 10 years ago #
  21. Chilifrei64

    Contributor
    Joined: Dec '05
    Posts: 541

    you are most likely not missing edits just styling problems.

    for starters.. (and I am not sure what your theme looks like) but if you need to make sure your sized are correct. if all your content in wordpress is displayed in say a 700px container and have a 200px sidebar.. that only leaves you with 500px for your gallery which the default image is 595px.. so that will cause this to happen.

    depending on how you r theme was styled.. you may need to change the sidebar to float:left(or right) and change the gallery to float:right(or left) so that you dont end up with what you are describing.

    I can tell you from personal experience (I had the same problem that you are explaining) was I just added the zp stylesheet to my wp stylesheet piece by piece because of conflicting tags with my theme.

    Posted 10 years ago #
  22. ny888

    Member
    Joined: Jul '06
    Posts: 31

  23. akhater

    Apprentice
    Joined: Sep '06
    Posts: 2

    can anyone please help me :(
    I followed the methods and it kind of worked, but I am unble to edit the css file :( :(
    please check it at http://www.adidap.com/gallery

    thanks

    Posted 10 years ago #
  24. akhater

    Apprentice
    Joined: Sep '06
    Posts: 2

    thanks it worked

    Posted 10 years ago #
  25. precious

    Member
    Joined: Oct '06
    Posts: 12

    my zenphoto integration was a success, thanks to ruzee! http://shadesofblack.free1k.com/zenphoto/ i used the 'testing' theme that came in with the zenphoto package and edited the css.

    Posted 10 years ago #
  26. amucklow

    Senior
    Joined: Sep '06
    Posts: 50

    My image.php page automatically sends a warning 'There was an error submitting your comment. Name, a valid e-mail address, and a comment are required.' I'm running the latest version of zenphoto (1.0.8.2), so there's no function name conflict with is_valid_email. I've integrated wordpress with zenphoto as per Ruzee's method.

    For example:

    http://hl.strangerpixel.com/techniques/beading/beading+006.jpg.php

    Thanks

    Posted 10 years ago #
  27. gekow

    Apprentice
    Joined: Apr '07
    Posts: 3

    The integration worked well for me and it looks quite good ( gekow.net/zenphoto/ ) but what doesn't work is the breadcrumb navigation (made by Breadcrumb Navigation XT plugin) nor is the gallery shown in the page title.

    Any idea?

    Posted 10 years ago #
  28. Luigino

    Apprentice
    Joined: May '07
    Posts: 2

    hello precious and chilifrei64... I'm trying to set up the sidebar_right positioned at his place and not under the content of zenphoto and I worked that out with ruzee method.... so I'm here asking you how did you settled up the css so we can have the sidebar_right at his right position?.... thanks!
    p.s.: I have WP 2.2 + Jide Freshy 2.0 Preview theme...

    Ciao, Luigi

    Posted 10 years ago #
  29. BertSimons

    Contributor
    Joined: Jun '07
    Posts: 196

    I managed to get it working thanks to ruzee tutorial..thanks ruzee!!!

    http://www.bertsimons.nl/zenphoto

    Posted 9 years ago #
  30. Anya

    Apprentice
    Joined: Apr '08
    Posts: 2

    Hi all,

    I'm in the mist of converting my site into Wordpress, but I love Zenphoto and don't want to give it up, so I've been playing around with integrating it into my WP. Last night I tried this via the Ruzee method suggested above. I thought that the walkthrough was very well written and clear, but I'm getting an error now that I can't figure out how to address:

    Fatal error: Call to undefined function bloginfo() in /home/.username/accountname/domain/wordpress/wp-content/themes/version03/header.php on line 4

    This line in the Wordpress header reads:

    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

    Any idea what I can do to address this? I deleted the line to see what would happen, but ZP simply found the next instance of "php bloginfo..." and gave me the same error, four lines down.

    I'm using WP 2.5.1, ZenphotoPress 1.4, and Zenphoto 1.0.8. Thanks so much for any help in advance! I'm new to the whole WP thing, but I love ZP and don't want to give it up!

    Posted 9 years ago #

RSS feed for this topic

Reply »

You must log in to post.