Integration with existing sites and other CMS 05/28/2013 / Updated: 01/08/2016
Match the look of your Zenphoto site to your existing site
This basically means to create a theme for your Zenphoto site to make it look like your existing site. For example by re-using HTML and CSS from it. Also please review our theming tutorial.
For WordPress specifially there are techniques available
For Wordpress specifially there are some third party Wordpress tools available.
Zenphoto as a "plugin"
This is a more advanced way to achieve that. You can use zenphoto features in your main web pages by including template-functions.php in your php pages. The following is an example of this technique. (The example assumes zenphoto is installed in a folder named zenphoto):
* This script is an example of how to use Zenphoto content from a Non-Zenphoto WEB page.
* You must define SERVERPATH and WEBPATH to correctly point at the Zenphoto installation.
* Here we are presuming that the running script is in the root of the WEBsite and the
* Zenphoto installation is in a folder named "zenphoto" within that root folder.
* Now we "include" the Zenphoto template functions. This will instantiate the Zenphoto installation
* and make all theme functions available to us.
<p>This example will show a pre-defined image. Really, almost any theme related actions could be done here.</p>
* Instantiate an image and make it the current image
$albumName = 'test_album/lesser-three-gorges';
$imageName = '2007-05-03-182646_sjb.jpg';
$image = newImage(NULL, array('folder'=>$albumName,'filename'=>$imageName));
* Show the image sized to "500"
printCustomSizedImage(getImageTitle(), 500); ?>
<!-- provide a link to the Zenphoto gallery -->
<p><a href="<?php echo WEBPATH; ?>">Visit the actual gallery from which this image was extracted.</a></p>
Note: Zenphoto makes use of global variables that are setup by the template functions load. This technique will NOT work if the require_once statement is done from within a function definition. Unfortunately WordPress and perhaps other application invoke their plugins from within functions, so invalidate this approach.
Many of the zenphoto template-functions operate on
$_zp_current_album, $_zp_current_image, and
$_zp_gallery. The first two are referred to as the
current album and current image in the function
documentation (see below.) These variables normally are setup by
the process of loading the root index.php file and
proceding to your theme php file. They will NOT be
setup automatically for you when you use zenphoto as a plugin. You
can use the functions zp_load_gallery(),
zp_load_album($folder), and zp_load_image($folder,
$filename) to set these variables. $folder is the
path from the album folder to the album. $filename is the
name of the image within $folder.
For further details on the template functions visit the Zenphoto Functions Guide.
This text by www.zenphoto.org is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.