<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Nate&#039;s blog &#187; integration</title>
	<atom:link href="http://www.natenewz.com/tag/integration/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.natenewz.com</link>
	<description>My various projects</description>
	<lastBuildDate>Tue, 29 Jun 2010 18:00:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Integrating Zenphoto and Wordpress</title>
		<link>http://www.natenewz.com/2009/10/13/integrating-zenphoto-and-wordpress/</link>
		<comments>http://www.natenewz.com/2009/10/13/integrating-zenphoto-and-wordpress/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 05:28:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[None]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[integration]]></category>
		<category><![CDATA[seamless]]></category>
		<category><![CDATA[zenphoto]]></category>

		<guid isPermaLink="false">http://www.natenewz.com/blog/?p=93</guid>
		<description><![CDATA[
Update: I am now using google picasa with the kpicasa plugin. I&#39;ve determined that this is the best method of putting a complete gallery onto a post or page. This completely eliminates zenphoto. If you are committed to using zenphoto, and you have your theme set up exactly the way you want it, then this [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.zenphoto.org/"><img alt="Zenphoto" class="size-medium wp-image-96" height="117" src="http://www.natenewz.com/wp-content/uploads/2009/10/zenphoto-300x108.jpg" title="zenphoto" width="329" /></a><a href="http://www.wordpress.org/"><img alt="wordpress" class="size-full wp-image-97" height="117" src="http://www.natenewz.com/wp-content/uploads/2009/10/wordpress-icon-512-300x300.png" title="wordpress-icon-512-300x300" width="117" /></a></p>
<p>Update: I am now using google picasa with the kpicasa plugin. I&#39;ve determined that this is the best method of putting a complete gallery onto a post or page. This completely eliminates zenphoto. If you are committed to using zenphoto, and you have your theme set up exactly the way you want it, then this method will work, but over time if you ever make a change to your wordpress theme, you have to update your look-alike zenphoto theme. Common plugins for zenphoto wordpress integration allow you to put individual albums or photos into posts.<br style="clear: both;" /><br />
	After reading <a href="http://wpengineer.com/embed-wordpress-functions-outside-wordpress/trackback/" target="_blank" title="Calling wordpress functions outside of wordpress">Frank&#39;s post on using wordpress functions outside of wordpress</a>, I had a good idea: Make a zenphoto theme with the wordpress navigation. This allows a nearly seamless level of integration between zenphoto and wordpress. The best starting point for this outline is if you already have a nice looking wordpress theme. The result of this will give you a wordpress &quot;page&quot; that redirects to a lookalike wordpress zenphoto theme complete with wordpress navigation, footer, page title, header, etc. First, you need a way of getting the paths of the blog directory, and the zenphoto directory. I have a www/blog/ folder and a www/gallery/ folder in this example. Place config.php in www/ config.php</p>
<pre class="prettyprint">< ?php
/* config file to unite wordpress and zenphoto */
define('BLOG_PATH', "$_SERVER['DOCUMENT_ROOT']/blog");
// do a var_dump($_SERVER); to find out what something is
define('GALLERY_PATH', "$_SERVER['DOCUMENT_ROOT']/gallery');
?></pre>
<p>You may have to var_dump($_SERVER) to find out the best way of getting to your site&#39;s directory. Okay, we have paths to reference from zenphoto to get to the wordpress directory. Let&#39;s dig into a zenphoto theme. Zenphoto themes are laid out with various files that are called depending on if you are at the zenphoto homepage (index.php), or if you have clicked on an album (album.php), or an image (image.php) and a few others. Your best bet is to copy the &#39;default&#39; zenphoto theme to a folder with a different name, such as nate-theme, then modify it. Let&#39;s look at index.php The first step is to follow Franks post and include the wordpress loader wp-load.php. Put at the very top of your zp-themes index.php file:</p>
<pre class="prettyprint" id="PHP">&lt; ?php
require_once(&quot;{$_SERVER[&#39;something&#39;]}/www/config.php&quot;);
require_once(BLOG_PATH.&quot;/wp-load.php&quot;);
// var_dump(get_current_theme()); // call this to see the name of the wordpress theme activated
if (get_current_theme() == &quot;My Wordpress Theme&quot;) // if the current theme is my wp theme, use it. otherwise use default zenphoto theme
{?&gt;
// wordpress html+php here
&lt; ?php
}else{
?&gt;
// original zenphoto default index.php file here
&lt;?php
}
?&gt;</pre>
<p>This is in case the wordpress theme get&#39;s changed to something else, zenphoto will revert back to the original html/php &#8212; whatever is in the else statement. So then, just copy the basic html structure from the header.php footer.php index.php files from your wordpress theme. You can now call the functions for listing the navigation, <a href="http://codex.wordpress.org/wp_list_pages">wp_list_pages()</a>, getting options <a href="http://codex.wordpress.org/Function_Reference/get_option">get_option()</a>, getting blog title and other information <a href="http://codex.wordpress.org/Template_Tags/bloginfo">bloginfo()</a>, etc. One requirement for this to work, is that the zenphoto and wordpress functions don&#39;t interfere. Luckily, no two functions have the same name, and so this does work. I haven&#39;t tested recreating the sidebar widgets in the zenphoto theme, although it should theoretically work. As for the zenphoto style sheet, I played a trick on apache to make this work. I told apache to parse .css files in the styles/ directory of zenphoto theme as a php file. Just make a .htaccess file in the styles directory, and add this line to it: AddType application/x-httpd-php .css This will allow you to apply the same technique as the index.php page with the if get_current_theme==xx else block. Just use the normal css in the else, and the wordpress css in the if parts. The last step to making this a nearly seamless integration is following my previous post on hardlinking the navigation. create the custom field redirect to the key /gallery/ or the url path to your gallery.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.natenewz.com/2009/10/13/integrating-zenphoto-and-wordpress/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>
