<?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>ActiveCodeline &#187; Drupal</title>
	<atom:link href="http://activecodeline.com/tag/drupal/feed" rel="self" type="application/rss+xml" />
	<link>http://activecodeline.com</link>
	<description>Blog site of Branko Ajzele, web application developer.</description>
	<lastBuildDate>Tue, 07 Sep 2010 05:59:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Drupal Zend Framework autoloader module, ActiveCodeline_ZendFrameworkLoader</title>
		<link>http://activecodeline.com/drupal-zend-framework-autoloader-module-activecodeline_zendframeworkloader</link>
		<comments>http://activecodeline.com/drupal-zend-framework-autoloader-module-activecodeline_zendframeworkloader#comments</comments>
		<pubDate>Mon, 22 Jun 2009 06:54:19 +0000</pubDate>
		<dc:creator>branko</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://activecodeline.com/?p=794</guid>
		<description><![CDATA[For all those poking around Drupal and Zend Framework, I wrote a little module that auto-loads Zend Framework. This module works with new Zend_Loader_Autoloader introduced in version 1.8. Therefore this Drupal module requires new 1.8 or higher version of Zend Framework library. Module is really simple, not much to it. Note that Zend Framework library [...]]]></description>
			<content:encoded><![CDATA[<p>For all those poking around Drupal and Zend Framework, I wrote a little module that auto-loads Zend Framework. This module works with new Zend_Loader_Autoloader introduced in version 1.8. Therefore this Drupal module requires new 1.8 or higher version of Zend Framework library. <span id="more-794"></span></p>
<p>Module is really simple, not much to it. Note that Zend Framework library it self is not packed with module, you need to download is separately and copy paste to modules /library folder.</p>
<p>It has only two files, one .info file needed for Drupal to recognize it and one .module file whose content you can see below.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> ZendFrameworkLoader_boot<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">//Get current file path, cut off the file name and use the rest as folder path</span>
	<span style="color: #000088;">$siteBasePath</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ZendFrameworkLoader.module'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//Append subfolder named 'library' to the path</span>
	<span style="color: #000088;">$siteLibraryPath</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$siteBasePath</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'library'</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//Add script wide include paths</span>
	<span style="color: #990000;">set_include_path</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'.'</span>	<span style="color: #339933;">.</span> PATH_SEPARATOR <span style="color: #339933;">.</span> <span style="color: #000088;">$siteLibraryPath</span>
							<span style="color: #339933;">.</span> PATH_SEPARATOR <span style="color: #339933;">.</span> <span style="color: #000088;">$siteLibraryPath</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/Zend'</span>
							<span style="color: #339933;">.</span> PATH_SEPARATOR <span style="color: #339933;">.</span> <span style="color: #990000;">get_include_path</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">include_once</span> <span style="color: #000088;">$siteLibraryPath</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/Zend/Loader/Autoloader.php'</span><span style="color: #339933;">;</span>
	Zend_Loader_Autoloader<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>As you can see module is using hook_boot() to handle (inject) auto-loading code. Therefore try not to call any of the Zend library components in hook_boot functions, latter is good.</p>
<p>Installing a module is done by simply copy-pasting unarchived module to /sites/all/modules/ folder. By doing so you should have /sites/all/modules/ActiveCodeline folder in place if you copy-pasted it ok.</p>
<p>Download <a href='http://activecodeline.com/wp-content/uploads/2009/06/activecodeline_zendframeworkloader.zip'>ActiveCodeline_ZendFrameworkLoader</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://activecodeline.com/drupal-zend-framework-autoloader-module-activecodeline_zendframeworkloader/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
