<?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>Brain Massage</title>
	<atom:link href="http://blog.brainmassage.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.brainmassage.co.uk</link>
	<description>Things that make me need a brain massage</description>
	<lastBuildDate>Wed, 21 Dec 2011 18:25:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Business Analysis &#8211; RACI Matrices</title>
		<link>http://blog.brainmassage.co.uk/2011/12/business-analysis-raci-matrices/</link>
		<comments>http://blog.brainmassage.co.uk/2011/12/business-analysis-raci-matrices/#comments</comments>
		<pubDate>Wed, 21 Dec 2011 18:23:14 +0000</pubDate>
		<dc:creator>shipleyr</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.robandhannah.co.uk/?p=300</guid>
		<description><![CDATA[An Introduction to Tools and&#160; Techniques I’ve recently been working as a Business Analysis trainer and in this position have had the opportunity to use and teach many interesting techniques. I though I’d share some of my thoughts on some &#8230; <a href="http://blog.brainmassage.co.uk/2011/12/business-analysis-raci-matrices/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h1>An Introduction to Tools and&nbsp; Techniques</h1>
<p>I’ve recently been working as a Business Analysis trainer and in this position have had the opportunity to use and teach many interesting techniques. I though I’d share some of my thoughts on some of the techniques as they come to me!</p>
<p>The first technique/tool I wanted to talk about is RACI Matrices. These are becoming <em>the</em> way of working with stakeholders and allow you to identify how a stakeholder is involved with a specific activity or process.</p>
<h2>A Case Study</h2>
<p>As I go through this article I will be using an example business system to show how the tool fits in. The example I will use will be for a library. A traditional library that lends books (you know… these places that lend dead trees to people by scanning a card, stamping a book and getting them to return the item when they’ve finished with it).</p>
<h1></h1>
<h1></h1>
<h1></h1>
<h2>What does RACI Stand for?</h2>
<p>RACI is an acronym which stands for “Responsible”, “Accountable”, “Consulted” and “Informed”.&nbsp; There are several variations to this but this is the most commonly used set so I will use this for the purpose of this article.</p>
<p>Now we know what the letters stand for lets consider what the categories mean and which stakeholders may fall into each within our library example.</p>
<h3>Responsible</h3>
<p>The stakeholders in this category are the ones who operate/run the area under investigation. In our library lets consider the function of “Lend Books”. The stakeholders we would consider responsible for the “Lend Books” function would be the librarians at the desk who take people’s library cards, scan the books and issue the loans to lenders.</p>
<h3>Accountable</h3>
<p>Accountable stakeholders are those at which “the buck stops”. The person with overall responsibility for the task at hand. Often a managerial role falls into the accountable area. In our library example it would be someone like the head of the librarians at the desk. This person is responsible for the accurate and complete completion of the “Lend Books” function.</p>
<h3>Consulted</h3>
<p>These stakeholders are people who need to be liaised with about the completion of the task. This implies a two way communication. In the library example if our lender has outstanding fines to pay for late return of items, an account administrator may be consulted as to the account status before a loan is permitted.</p>
<h3>Informed</h3>
<p>Informed stakeholders are those who are “kept in the loop” about goings on but do not have any input to the operation of the function. Due to the non-input nature of this relationship a single direction of communication is inferred here. In out library example, the overall library manager may wish for management information about the number of loans or other performance metrics of the process and would therefore be informed about the process.</p>
<h2>RACI Roles</h2>
<p>Now we have an idea of what each element of the RACI are lets lay out some rules for using a RACI Matrix (We’ll see soon why it’s called a matrix).</p>
<ul>
<li>Responsible and Accountable positions are only assigned to one stakeholder role.
<li>Often the role that is accountable for a task is also responsible for it. In this case only the Accountable role is added and the Responsible is assumed to be the same person
<li>Except for the Responsible and Accountable roles, all other roles are mutually exclusive. For example, a stakeholder can not be both Responsible for a task as well as Informed about the task.
<li>The role that is Responsible for a task obtains information required to complete the task from the Consulted role. This implies a two-way communication.
<li>The Responsible role updates the Informed role about the task. This implies a one way channel of communication.
<li>The Responsible role may delegate responsibilities to others in their team.</li>
</ul>
<h2>Why a Matrix?</h2>
<p>Lets get an idea of why it’s called a RACI Matrix. Usually the roles/tasks/stakeholders are presented in tabular form. Let’s build a table for the library example presented in this article.</p>
<table border="1" cellspacing="0" cellpadding="2" width="639">
<tbody>
<tr>
<th valign="top" width="128"></th>
<th valign="top" width="120">Librarian</th>
<th valign="top" width="105">Lender</th>
<th valign="top" width="120">Library Manager</th>
<th valign="top" width="58">Finance Clerk</th>
<th valign="top" width="106">County Council</th>
</tr>
<tr>
<td valign="top" width="128"><font size="2" face="Arial">Lend Book</font></td>
<td valign="top" width="120"><font size="2" face="Arial">R</font></td>
<td valign="top" width="105"><font size="2" face="Arial">C</font></td>
<td valign="top" width="120"><font size="2" face="Arial">A</font></td>
<td valign="top" width="58"><font size="2" face="Arial">C</font></td>
<td valign="top" width="106"><font size="2" face="Arial">I</font></td>
</tr>
<tr>
<td valign="top" width="128"><font size="2" face="Arial">Return Book</font></td>
<td valign="top" width="120"><font size="2" face="Arial">R</font></td>
<td valign="top" width="105"><font size="2" face="Arial">C</font></td>
<td valign="top" width="120"><font size="2" face="Arial">A</font></td>
<td valign="top" width="58"><font size="2" face="Arial">C</font></td>
<td valign="top" width="106"><font size="2" face="Arial">I</font></td>
</tr>
<tr>
<td valign="top" width="128"><font size="2" face="Arial">Set Targets</font></td>
<td valign="top" width="120"><font size="2" face="Arial">I</font></td>
<td valign="top" width="105"><font size="2" face="Arial"></font></td>
<td valign="top" width="120"><font size="2" face="Arial">A</font></td>
<td valign="top" width="58"><font size="2" face="Arial">I</font></td>
<td valign="top" width="106"><font size="2" face="Arial">C</font></td>
</tr>
<tr>
<td valign="top" width="128"><font size="2" face="Arial">Register New Borrowers</font></td>
<td valign="top" width="120"><font size="2" face="Arial">R</font></td>
<td valign="top" width="105"><font size="2" face="Arial">C</font></td>
<td valign="top" width="121"><font size="2" face="Arial">A</font></td>
<td valign="top" width="59"><font size="2" face="Arial">I</font></td>
<td valign="top" width="108"><font size="2" face="Arial">I</font></td>
</tr>
</tbody>
</table>
<p>Based on the above lets look at the matrix. We have a county council linked with the library who oversee the operation of the library and want information about the number of items leant, the number of returns, late loans etc. They are not involved in the operation of the library but need information from it.</p>
<p>There are multiple roles that are consulted to complete certain tasks. For example, the lend books function relies on both the lender and the finance clerk to provide information to allow the function to be completed. Similarly with “Register New Borrowers” updates both the County Council and Finance Clerk about the output of registering new borrowers.</p>
<p>The “Set Targets” function does not have a Responsible task specified directly and therefore this falls under the Accountable task to complete, i.e. the Library Manager.</p>
<h2>Summary</h2>
<p>This technique is a very useful tool for business analysts and project managers to aid with stakeholder management. It provides useful information about the functions and processes being investigated and which stakeholders may be affected by any proposed changes. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.brainmassage.co.uk/2011/12/business-analysis-raci-matrices/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend Framework Smarty Integration</title>
		<link>http://blog.brainmassage.co.uk/2011/08/zend-framework-smarty-integration/</link>
		<comments>http://blog.brainmassage.co.uk/2011/08/zend-framework-smarty-integration/#comments</comments>
		<pubDate>Wed, 17 Aug 2011 09:21:28 +0000</pubDate>
		<dc:creator>shipleyr</dc:creator>
				<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://blog.robandhannah.co.uk/?p=256</guid>
		<description><![CDATA[I&#8217;ve been working with zend framework for some time and have been using the Smarty template engine for the views. Initially we were working well with the smarty integration but have just come across a problem. I&#8217;ve been using partials &#8230; <a href="http://blog.brainmassage.co.uk/2011/08/zend-framework-smarty-integration/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working with zend framework for some time and have been using the Smarty template engine for the views. Initially we were working well with the smarty integration but have just come across a problem. I&#8217;ve been using partials for Zend Navigation elements so I can create custom layouts.</p>
<p>The problem I was experiencing was that all my assigned variables were being cleared after the navigation partial has been called. The cause of this problem is that when partials are rendered the view object gets cloned to make sure that the partial is rendered in it&#8217;s own address space. With my previous integration the view object was not being cloned correctly and the current view object was being returned and then all the variables in the object was being cleared.</p>
<p>To fix this I found a new smarty integration on the internet based on the currently used view integration and adopted this into my object&#8230; I&#8217;ve included it below!</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="php"><pre class="de1"><span class="co4">/**
* Smarty template engine integration into Zend Framework
* Some ideas borrowed from http://devzone.zend.com/article/120
*/</span>
<span class="kw2">class</span> ZendExt_View_Smarty <span class="kw2">extends</span> Zend_View_Abstract
<span class="br0">&#123;</span>
	<span class="co4">/**
	 * Instance of Smarty
	 * @var Smarty
	 */</span>
	<span class="kw2">protected</span> <span class="re0">$_smarty</span> <span class="sy0">=</span> <span class="kw4">null</span><span class="sy0">;</span>
&nbsp;
	<span class="co4">/**
	 * Template explicitly set to render in this view
	 * @var string
	 */</span>
	<span class="kw2">protected</span> <span class="re0">$_customTemplate</span> <span class="sy0">=</span> <span class="st_h">''</span><span class="sy0">;</span>
&nbsp;
	<span class="co4">/**
	 * Smarty config
	 * @var array
	 */</span>
	<span class="kw2">private</span> <span class="re0">$_config</span> <span class="sy0">=</span> <span class="kw4">null</span><span class="sy0">;</span>
&nbsp;
	<span class="co4">/**
	 * Class definition and constructor
	 *
	 * Let's start with the class definition and the constructor part. My class Travello_View_Smarty is extending the Zend_View_Abstract class. In the constructor the parent constructor from Zend_View_Abstract is called first. After that a Smarty object is instantiated, configured and stored in a private attribute.
	 * Please note that I use a configuration object from the object store to get the configuration data for Smarty.
	 *
	 * @param array $smartyConfig
	 * @param array $config
	 */</span>
	<span class="kw2">public</span> <span class="kw2">function</span> __construct<span class="br0">&#40;</span><span class="re0">$smartyConfig</span><span class="sy0">,</span> <span class="re0">$config</span> <span class="sy0">=</span> <span class="kw3">array</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>
	<span class="br0">&#123;</span>
		<span class="re0">$this</span><span class="sy0">-&gt;</span>_config <span class="sy0">=</span> <span class="re0">$smartyConfig</span><span class="sy0">;</span>
		parent<span class="sy0">::</span>__construct<span class="br0">&#40;</span><span class="re0">$config</span><span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="re0">$this</span><span class="sy0">-&gt;</span>_loadSmarty<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
	<span class="br0">&#125;</span>
&nbsp;
	<span class="co4">/**
	 * Return the template engine object
	 *
	 * @return Smarty
	 */</span>
	<span class="kw2">public</span> <span class="kw2">function</span> getEngine<span class="br0">&#40;</span><span class="br0">&#41;</span>
	<span class="br0">&#123;</span>
		<span class="kw1">return</span> <span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">;</span>
	<span class="br0">&#125;</span>
&nbsp;
	<span class="co4">/**
	 * Implement _run() method
	 *
	 * The method _run() is the only method that needs to be implemented in any subclass of Zend_View_Abstract. It is called automatically within the render() method. My implementation just uses the display() method from Smarty to generate and output the template.
	 *
	 * @param string $template
	 */</span>
	<span class="kw2">protected</span> <span class="kw2">function</span> _run<span class="br0">&#40;</span><span class="br0">&#41;</span>
	<span class="br0">&#123;</span>
		<span class="re0">$file</span> <span class="sy0">=</span> <span class="kw3">func_num_args</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">&gt;</span> <span class="nu0">0</span> <span class="sy0">&amp;&amp;</span> <span class="kw3">file_exists</span><span class="br0">&#40;</span><span class="kw3">func_get_arg</span><span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span><span class="br0">&#41;</span> ? <span class="kw3">func_get_arg</span><span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span> <span class="sy0">:</span> <span class="st_h">''</span><span class="sy0">;</span>
		<span class="kw1">if</span> <span class="br0">&#40;</span><span class="re0">$this</span><span class="sy0">-&gt;</span>_customTemplate <span class="sy0">||</span> <span class="re0">$file</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
			<span class="re0">$template</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-&gt;</span>_customTemplate<span class="sy0">;</span>
			<span class="kw1">if</span> <span class="br0">&#40;</span><span class="sy0">!</span><span class="re0">$template</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
				<span class="re0">$template</span> <span class="sy0">=</span> <span class="re0">$file</span><span class="sy0">;</span>
			<span class="br0">&#125;</span>
&nbsp;
			<span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">display</span><span class="br0">&#40;</span><span class="re0">$template</span><span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span>
			<span class="kw1">throw</span> <span class="kw2">new</span> Zend_View_Exception<span class="br0">&#40;</span><span class="st_h">'Cannot render view without any template being assigned or file does not exist'</span><span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="br0">&#125;</span>
	<span class="br0">&#125;</span>
&nbsp;
	<span class="co4">/**
	 * Overwrite assign() method
	 *
	 * The next part is an overwrite of the assign() method from Zend_View_Abstract, which works in a similar way. The big difference is that the values are assigned to the Smarty object and not to the $this-&gt;_vars variables array of Zend_View_Abstract.
	 *
	 * @param string|array $var
	 * @return Ext_View_Smarty
	 */</span>
	<span class="kw2">public</span> <span class="kw2">function</span> assign<span class="br0">&#40;</span><span class="re0">$var</span><span class="sy0">,</span> <span class="re0">$value</span> <span class="sy0">=</span> <span class="kw4">null</span><span class="br0">&#41;</span>
	<span class="br0">&#123;</span>
		<span class="kw1">if</span> <span class="br0">&#40;</span><span class="kw3">is_string</span><span class="br0">&#40;</span><span class="re0">$var</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
			<span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">assign</span><span class="br0">&#40;</span><span class="re0">$var</span><span class="sy0">,</span> <span class="re0">$value</span><span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="br0">&#125;</span> <span class="kw1">elseif</span> <span class="br0">&#40;</span><span class="kw3">is_array</span><span class="br0">&#40;</span><span class="re0">$var</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
			<span class="kw1">foreach</span> <span class="br0">&#40;</span><span class="re0">$var</span> <span class="kw1">as</span> <span class="re0">$key</span> <span class="sy0">=&gt;</span> <span class="re0">$value</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
				<span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">assign</span><span class="br0">&#40;</span><span class="re0">$key</span><span class="sy0">,</span> <span class="re0">$value</span><span class="br0">&#41;</span><span class="sy0">;</span>
			<span class="br0">&#125;</span>
		<span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span>
			<span class="kw1">throw</span> <span class="kw2">new</span> Zend_View_Exception<span class="br0">&#40;</span><span class="st_h">'assign() expects a string or array, got '</span><span class="sy0">.</span><span class="kw3">gettype</span><span class="br0">&#40;</span><span class="re0">$var</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="br0">&#125;</span>
	<span class="br0">&#125;</span>
&nbsp;
	<span class="co4">/**
	 * Overwrite escape() method
	 *
	 * The next part is an overwrite of the escape() method from Zend_View_Abstract. It works both for string and array values and also uses the escape() method from the Zend_View_Abstract. The advantage of this is that I don't have to care about each value of an array to get properly escaped.
	 *
	 * @param mixed $var
	 * @return mixed
	 */</span>
	<span class="kw2">public</span> <span class="kw2">function</span> escape<span class="br0">&#40;</span><span class="re0">$var</span><span class="br0">&#41;</span>
	<span class="br0">&#123;</span>
		<span class="kw1">if</span> <span class="br0">&#40;</span><span class="kw3">is_string</span><span class="br0">&#40;</span><span class="re0">$var</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
			<span class="kw1">return</span> parent<span class="sy0">::</span><span class="me2">escape</span><span class="br0">&#40;</span><span class="re0">$var</span><span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="br0">&#125;</span> <span class="kw1">elseif</span> <span class="br0">&#40;</span><span class="kw3">is_array</span><span class="br0">&#40;</span><span class="re0">$var</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
			<span class="kw1">foreach</span> <span class="br0">&#40;</span><span class="re0">$var</span> <span class="kw1">as</span> <span class="re0">$key</span> <span class="sy0">=&gt;</span> <span class="re0">$val</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
				<span class="re0">$var</span><span class="br0">&#91;</span><span class="re0">$key</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">escape</span><span class="br0">&#40;</span><span class="re0">$val</span><span class="br0">&#41;</span><span class="sy0">;</span>
			<span class="br0">&#125;</span>
		<span class="br0">&#125;</span>
		<span class="kw1">return</span> <span class="re0">$var</span><span class="sy0">;</span>
	<span class="br0">&#125;</span>
&nbsp;
	<span class="co4">/**
	 * Print the output
	 *
	 * The next method output() is a wrapper on the render() method from Zend_View_Abstract. It just sets some headers before printing the output.
	 *
	 * @param &lt;type&gt; $name
	 */</span>
	<span class="kw2">public</span> <span class="kw2">function</span> output<span class="br0">&#40;</span><span class="re0">$name</span><span class="br0">&#41;</span>
	<span class="br0">&#123;</span>
		<span class="kw3">header</span><span class="br0">&#40;</span><span class="st0">&quot;Expires: Mon, 26 Jul 1997 05:00:00 GMT&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="kw3">header</span><span class="br0">&#40;</span><span class="st0">&quot;Cache-Control: no-cache&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="kw3">header</span><span class="br0">&#40;</span><span class="st0">&quot;Pragma: no-cache&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="kw3">header</span><span class="br0">&#40;</span><span class="st0">&quot;Cache-Control: post-check=0, pre-check=0&quot;</span><span class="sy0">,</span> <span class="kw4">false</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
		<span class="kw1">print</span> parent<span class="sy0">::</span><span class="me2">render</span><span class="br0">&#40;</span><span class="re0">$name</span><span class="br0">&#41;</span><span class="sy0">;</span>
	<span class="br0">&#125;</span>
&nbsp;
	<span class="co4">/**
	 * Use Smarty caching
	 *
	 * The last two methods were created to simply integrate the Smarty caching mechanism in the View class. With the first one you can check for cached template and with the second one you can set the caching on or of.
	 *
	 * @param string $template
	 * @return bool
	 */</span>
	<span class="kw2">public</span> <span class="kw2">function</span> isCached<span class="br0">&#40;</span><span class="re0">$template</span><span class="br0">&#41;</span>
	<span class="br0">&#123;</span>
		<span class="kw1">return</span> <span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">is_cached</span><span class="br0">&#40;</span><span class="re0">$template</span><span class="br0">&#41;</span><span class="sy0">;</span>
	<span class="br0">&#125;</span>
&nbsp;
	<span class="co4">/**
	 * Enable/disable caching
	 *
	 * @param bool $caching
	 * @return Ext_View_Smarty
	 */</span>
	<span class="kw2">public</span> <span class="kw2">function</span> setCaching<span class="br0">&#40;</span><span class="re0">$caching</span><span class="br0">&#41;</span>
	<span class="br0">&#123;</span>
		<span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">caching</span> <span class="sy0">=</span> <span class="re0">$caching</span><span class="sy0">;</span>
		<span class="kw1">return</span> <span class="re0">$this</span><span class="sy0">;</span>
	<span class="br0">&#125;</span>
&nbsp;
	<span class="co4">/**
	 * Template getter (return file path)
	 * @return string
	 */</span>
	<span class="kw2">public</span> <span class="kw2">function</span> getTemplate<span class="br0">&#40;</span><span class="br0">&#41;</span>
	<span class="br0">&#123;</span>
		<span class="kw1">return</span> <span class="re0">$this</span><span class="sy0">-&gt;</span>_customTemplate<span class="sy0">;</span>
	<span class="br0">&#125;</span>
&nbsp;
	<span class="co4">/**
	 * Template filename setter
	 * @param string
	 * @return Ext_View_Smarty
	 */</span>
	<span class="kw2">public</span> <span class="kw2">function</span> setTemplate<span class="br0">&#40;</span><span class="re0">$tpl</span><span class="br0">&#41;</span>
	<span class="br0">&#123;</span>
		<span class="re0">$this</span><span class="sy0">-&gt;</span>_customTemplate <span class="sy0">=</span> <span class="re0">$tpl</span><span class="sy0">;</span>
		<span class="kw1">return</span> <span class="re0">$this</span><span class="sy0">;</span>
	<span class="br0">&#125;</span>
&nbsp;
	<span class="co4">/**
	 * Magic setter for Zend_View compatibility. Performs assign()
	 *
	 * @param string $key
	 * @param mixed $val
	 */</span>
	<span class="kw2">public</span> <span class="kw2">function</span> __set<span class="br0">&#40;</span><span class="re0">$key</span><span class="sy0">,</span> <span class="re0">$val</span><span class="br0">&#41;</span>
	<span class="br0">&#123;</span>
		<span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">assign</span><span class="br0">&#40;</span><span class="re0">$key</span><span class="sy0">,</span> <span class="re0">$val</span><span class="br0">&#41;</span><span class="sy0">;</span>
	<span class="br0">&#125;</span>
&nbsp;
&nbsp;
	<span class="co4">/**
	 * Magic getter for Zend_View compatibility. Retrieves template var
	 *
	 * @param string $key
	 * @return mixed
	 */</span>
	<span class="kw2">public</span> <span class="kw2">function</span> __get<span class="br0">&#40;</span><span class="re0">$key</span><span class="br0">&#41;</span>
	<span class="br0">&#123;</span>
		<span class="kw1">return</span> <span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">getTemplateVars</span><span class="br0">&#40;</span><span class="re0">$key</span><span class="br0">&#41;</span><span class="sy0">;</span>
	<span class="br0">&#125;</span>
&nbsp;
	<span class="co4">/**
	 * Magic getter for Zend_View compatibility. Removes template var
	 *
	 * @see View/Zend_View_Abstract::__unset()
	 * @param string $key
	 */</span>
	<span class="kw2">public</span> <span class="kw2">function</span> __unset<span class="br0">&#40;</span><span class="re0">$key</span><span class="br0">&#41;</span>
	<span class="br0">&#123;</span>
		<span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">clearAssign</span><span class="br0">&#40;</span><span class="re0">$key</span><span class="br0">&#41;</span><span class="sy0">;</span>
	<span class="br0">&#125;</span>
&nbsp;
	<span class="co4">/**
	 * Allows testing with empty() and isset() to work
	 * Zend_View compatibility. Checks template var for existance
	 *
	 * @param string $key
	 * @return boolean
	 */</span>
	<span class="kw2">public</span> <span class="kw2">function</span> __isset<span class="br0">&#40;</span><span class="re0">$key</span><span class="br0">&#41;</span>
	<span class="br0">&#123;</span>
		<span class="kw1">return</span> <span class="br0">&#40;</span><span class="kw4">null</span> <span class="sy0">!==</span> <span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">getTemplateVars</span><span class="br0">&#40;</span><span class="re0">$key</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span>
	<span class="br0">&#125;</span>
&nbsp;
	<span class="co4">/**
	 * Zend_View compatibility. Retrieves all template vars
	 *
	 * @see Zend_View_Abstract::getVars()
	 * @return array
	 */</span>
	<span class="kw2">public</span> <span class="kw2">function</span> getVars<span class="br0">&#40;</span><span class="br0">&#41;</span>
	<span class="br0">&#123;</span>
		<span class="kw1">return</span> <span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">getTemplateVars</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
	<span class="br0">&#125;</span>
&nbsp;
	<span class="co4">/**
	 * Updates Smarty's template_dir field with new value
	 *
	 * @param string $dir
	 * @return Ext_View_Smarty
	 */</span>
	<span class="kw2">public</span> <span class="kw2">function</span> setTemplateDir<span class="br0">&#40;</span><span class="re0">$dir</span><span class="br0">&#41;</span>
	<span class="br0">&#123;</span>
		<span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">setTemplateDir</span><span class="br0">&#40;</span><span class="re0">$dir</span><span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="kw1">return</span> <span class="re0">$this</span><span class="sy0">;</span>
	<span class="br0">&#125;</span>
&nbsp;
	<span class="co4">/**
	 * Adds another Smarty template_dir to scan for templates
	 *
	 * @param string $dir
	 * @return Ext_View_Smarty
	 */</span>
	<span class="kw2">public</span> <span class="kw2">function</span> addTemplateDir<span class="br0">&#40;</span><span class="re0">$dir</span><span class="br0">&#41;</span>
	<span class="br0">&#123;</span>
		<span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">addTemplateDir</span><span class="br0">&#40;</span><span class="re0">$dir</span><span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="kw1">return</span> <span class="re0">$this</span><span class="sy0">;</span>
	<span class="br0">&#125;</span>
&nbsp;
	<span class="co4">/**
	 * Adds another Smarty plugin directory to scan for plugins
	 *
	 * @param string $dir
	 * @return Ext_View_Smarty
	 */</span>
	<span class="kw2">public</span> <span class="kw2">function</span> addPluginDir<span class="br0">&#40;</span><span class="re0">$dir</span><span class="br0">&#41;</span>
	<span class="br0">&#123;</span>
		<span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">addPluginsDir</span><span class="br0">&#40;</span><span class="re0">$dir</span><span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="kw1">return</span> <span class="re0">$this</span><span class="sy0">;</span>
	<span class="br0">&#125;</span>
&nbsp;
	<span class="co4">/**
	 * Zend_View compatibility. Removes all template vars
	 *
	 * @see View/Zend_View_Abstract::clearVars()
	 * @return Ext_View_Smarty
	 */</span>
	<span class="kw2">public</span> <span class="kw2">function</span> clearVars<span class="br0">&#40;</span><span class="br0">&#41;</span>
	<span class="br0">&#123;</span>
		<span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">clearAllAssign</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">assign</span><span class="br0">&#40;</span><span class="st_h">'this'</span><span class="sy0">,</span> <span class="re0">$this</span><span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="kw1">return</span> <span class="re0">$this</span><span class="sy0">;</span>
	<span class="br0">&#125;</span>
&nbsp;
	<span class="co4">/**
	 * Zend_View compatibility. Add the templates dir
	 *
	 * @see View/Zend_View_Abstract::addBasePath()
	 * @return Ext_View_Smarty
	 */</span>	<span class="kw2">public</span> <span class="kw2">function</span> addBasePath<span class="br0">&#40;</span><span class="re0">$path</span><span class="sy0">,</span> <span class="re0">$classPrefix</span> <span class="sy0">=</span> <span class="st_h">'Zend_View'</span><span class="br0">&#41;</span>
	<span class="br0">&#123;</span>
		parent<span class="sy0">::</span><span class="me2">addBasePath</span><span class="br0">&#40;</span><span class="re0">$path</span><span class="sy0">,</span> <span class="re0">$classPrefix</span><span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">addScriptPath</span><span class="br0">&#40;</span><span class="re0">$path</span> <span class="sy0">.</span> <span class="st_h">'/templates'</span><span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">addTemplateDir</span><span class="br0">&#40;</span><span class="re0">$path</span> <span class="sy0">.</span> <span class="st_h">'/templates/static'</span><span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="kw1">return</span> <span class="re0">$this</span><span class="sy0">;</span>
	<span class="br0">&#125;</span>
&nbsp;
	<span class="co4">/**
	 * Zend_View compatibility. Set the templates dir instead of scripts
	 *
	 * @see View/Zend_View_Abstract::setBasePath()
	 * @return Ext_View_Smarty
	 */</span>
	<span class="kw2">public</span> <span class="kw2">function</span> setBasePath<span class="br0">&#40;</span><span class="re0">$path</span><span class="sy0">,</span> <span class="re0">$classPrefix</span> <span class="sy0">=</span> <span class="st_h">'Zend_View'</span><span class="br0">&#41;</span>
	<span class="br0">&#123;</span>
		parent<span class="sy0">::</span><span class="me2">setBasePath</span><span class="br0">&#40;</span><span class="re0">$path</span><span class="sy0">,</span> <span class="re0">$classPrefix</span><span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">setScriptPath</span><span class="br0">&#40;</span><span class="re0">$path</span> <span class="sy0">.</span> <span class="st_h">'/templates'</span><span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">addTemplateDir</span><span class="br0">&#40;</span><span class="re0">$path</span> <span class="sy0">.</span> <span class="st_h">'/templates/static'</span><span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="kw1">return</span> <span class="re0">$this</span><span class="sy0">;</span>
	<span class="br0">&#125;</span>
&nbsp;
	<span class="co4">/**
	 * Magic clone method, on clone create diferent smarty object
	 */</span>
	<span class="kw2">public</span> <span class="kw2">function</span> __clone<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
		<span class="re0">$this</span><span class="sy0">-&gt;</span>_loadSmarty<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
	<span class="br0">&#125;</span>
&nbsp;
	<span class="co4">/**
	 * Initializes the smarty and populates config params
	 *
	 * @throws Zend_View_Exception
	 * @return void
	 */</span>
	<span class="kw2">private</span> <span class="kw2">function</span> _loadSmarty<span class="br0">&#40;</span><span class="br0">&#41;</span>
	<span class="br0">&#123;</span>
		<span class="kw1">if</span> <span class="br0">&#40;</span><span class="sy0">!</span><span class="kw3">class_exists</span><span class="br0">&#40;</span><span class="st_h">'Smarty'</span><span class="sy0">,</span> <span class="kw4">true</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
			<span class="kw1">require_once</span> <span class="st_h">'Smarty/Smarty.class.php'</span><span class="sy0">;</span>
		<span class="br0">&#125;</span>
&nbsp;
		<span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty <span class="sy0">=</span> <span class="kw2">new</span> Smarty<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
		<span class="kw1">if</span> <span class="br0">&#40;</span><span class="re0">$this</span><span class="sy0">-&gt;</span>_config <span class="sy0">===</span> <span class="kw4">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
			<span class="kw1">throw</span> <span class="kw2">new</span> Zend_View_Exception<span class="br0">&#40;</span><span class="st0">&quot;Could not locate Smarty config - node 'smarty' not found&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
		<span class="br0">&#125;</span>
&nbsp;
		<span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">caching</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-&gt;</span>_config<span class="br0">&#91;</span><span class="st_h">'smarty'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'caching'</span><span class="br0">&#93;</span><span class="sy0">;</span>
		<span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">cache_lifetime</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-&gt;</span>_config<span class="br0">&#91;</span><span class="st_h">'smarty'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'cache_lifetime'</span><span class="br0">&#93;</span><span class="sy0">;</span>
		<span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">template_dir</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-&gt;</span>_config<span class="br0">&#91;</span><span class="st_h">'smarty'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'template_dir'</span><span class="br0">&#93;</span><span class="sy0">;</span>
		<span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">compile_dir</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-&gt;</span>_config<span class="br0">&#91;</span><span class="st_h">'smarty'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'compile_dir'</span><span class="br0">&#93;</span><span class="sy0">;</span>
		<span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">config_dir</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-&gt;</span>_config<span class="br0">&#91;</span><span class="st_h">'smarty'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'config_dir'</span><span class="br0">&#93;</span><span class="sy0">;</span>
		<span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">cache_dir</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-&gt;</span>_config<span class="br0">&#91;</span><span class="st_h">'smarty'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'cache_dir'</span><span class="br0">&#93;</span><span class="sy0">;</span>
		<span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">left_delimiter</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-&gt;</span>_config<span class="br0">&#91;</span><span class="st_h">'smarty'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'left_delimiter'</span><span class="br0">&#93;</span><span class="sy0">;</span>
		<span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">right_delimiter</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-&gt;</span>_config<span class="br0">&#91;</span><span class="st_h">'smarty'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'right_delimiter'</span><span class="br0">&#93;</span><span class="sy0">;</span>
&nbsp;
		<span class="kw1">if</span><span class="br0">&#40;</span><span class="kw3">isset</span><span class="br0">&#40;</span><span class="re0">$this</span><span class="sy0">-&gt;</span>_config<span class="br0">&#91;</span><span class="st_h">'smarty'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'plugins_dir'</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>
		<span class="br0">&#123;</span>
			<span class="kw1">foreach</span><span class="br0">&#40;</span><span class="re0">$this</span><span class="sy0">-&gt;</span>_config<span class="br0">&#91;</span><span class="st_h">'smarty'</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="st_h">'plugins_dir'</span><span class="br0">&#93;</span> <span class="kw1">as</span> <span class="re0">$pluginDir</span><span class="br0">&#41;</span>
			<span class="br0">&#123;</span>
				<span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">addPluginDir</span><span class="br0">&#40;</span><span class="re0">$pluginDir</span><span class="br0">&#41;</span><span class="sy0">;</span>
			<span class="br0">&#125;</span>
		<span class="br0">&#125;</span>
&nbsp;
		<span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">assign</span><span class="br0">&#40;</span><span class="st_h">'this'</span><span class="sy0">,</span> <span class="re0">$this</span><span class="br0">&#41;</span><span class="sy0">;</span>
	<span class="br0">&#125;</span>
&nbsp;
&nbsp;
&nbsp;
	<span class="kw2">public</span> <span class="kw2">function</span> addScriptPath<span class="br0">&#40;</span><span class="re0">$path</span><span class="br0">&#41;</span>
	<span class="br0">&#123;</span>
		<span class="kw1">if</span><span class="br0">&#40;</span><span class="sy0">!</span><span class="kw3">isset</span><span class="br0">&#40;</span><span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">template_dir</span><span class="br0">&#41;</span><span class="br0">&#41;</span>
		<span class="br0">&#123;</span>
			<span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">template_dir</span> <span class="sy0">=</span> <span class="re0">$path</span><span class="sy0">;</span>
		<span class="br0">&#125;</span>
		<span class="kw1">else</span>
		<span class="br0">&#123;</span>
			<span class="kw1">if</span><span class="br0">&#40;</span><span class="sy0">!</span><span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">checkScriptPathExists</span><span class="br0">&#40;</span><span class="re0">$path</span><span class="br0">&#41;</span><span class="br0">&#41;</span>
			<span class="br0">&#123;</span>
				<span class="kw1">if</span><span class="br0">&#40;</span><span class="sy0">!</span><span class="kw3">is_array</span><span class="br0">&#40;</span><span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">template_dir</span><span class="br0">&#41;</span><span class="br0">&#41;</span>
				<span class="br0">&#123;</span>
					<span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">template_dir</span> <span class="sy0">=</span> <span class="kw3">array</span><span class="br0">&#40;</span><span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">template_dir</span><span class="br0">&#41;</span><span class="sy0">;</span>
				<span class="br0">&#125;</span>
&nbsp;
				<span class="kw3">array_unshift</span><span class="br0">&#40;</span><span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">template_dir</span><span class="sy0">,</span> <span class="re0">$path</span><span class="br0">&#41;</span><span class="sy0">;</span>
			<span class="br0">&#125;</span>
		<span class="br0">&#125;</span>
&nbsp;
		parent<span class="sy0">::</span><span class="me2">addScriptPath</span><span class="br0">&#40;</span><span class="re0">$path</span><span class="br0">&#41;</span><span class="sy0">;</span>
	<span class="br0">&#125;</span>
&nbsp;
	<span class="kw2">private</span> <span class="kw2">function</span> checkScriptPathExists<span class="br0">&#40;</span><span class="re0">$path</span><span class="br0">&#41;</span>
	<span class="br0">&#123;</span>
		<span class="re0">$dirs</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-&gt;</span>_smarty<span class="sy0">-&gt;</span><span class="me1">template_dir</span><span class="sy0">;</span>
&nbsp;
		<span class="kw1">if</span><span class="br0">&#40;</span><span class="kw3">is_array</span><span class="br0">&#40;</span><span class="re0">$dirs</span><span class="br0">&#41;</span><span class="br0">&#41;</span>
		<span class="br0">&#123;</span>
			<span class="kw1">foreach</span><span class="br0">&#40;</span><span class="re0">$dirs</span> <span class="kw1">as</span> <span class="re0">$dir</span><span class="br0">&#41;</span>
			<span class="br0">&#123;</span>
				<span class="kw1">if</span><span class="br0">&#40;</span><span class="re0">$dir</span> <span class="sy0">==</span> <span class="re0">$path</span><span class="br0">&#41;</span>
				<span class="br0">&#123;</span>
					<span class="kw1">return</span> <span class="kw4">true</span><span class="sy0">;</span>
				<span class="br0">&#125;</span>
			<span class="br0">&#125;</span>
		<span class="br0">&#125;</span>
		<span class="kw1">else</span>
		<span class="br0">&#123;</span>
			<span class="kw1">if</span><span class="br0">&#40;</span><span class="re0">$dirs</span> <span class="sy0">==</span> <span class="re0">$path</span><span class="br0">&#41;</span>
			<span class="br0">&#123;</span>
				<span class="kw1">return</span> <span class="kw4">true</span><span class="sy0">;</span>
			<span class="br0">&#125;</span>
		<span class="br0">&#125;</span>
		<span class="kw1">return</span> <span class="kw4">false</span><span class="sy0">;</span>
	<span class="br0">&#125;</span>
<span class="br0">&#125;</span></pre></div></div></div></div></div></div></div>


]]></content:encoded>
			<wfw:commentRss>http://blog.brainmassage.co.uk/2011/08/zend-framework-smarty-integration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend Navigation&#8217;s isActive method</title>
		<link>http://blog.brainmassage.co.uk/2011/08/zend-navigations-isactive-method/</link>
		<comments>http://blog.brainmassage.co.uk/2011/08/zend-navigations-isactive-method/#comments</comments>
		<pubDate>Tue, 09 Aug 2011 11:45:10 +0000</pubDate>
		<dc:creator>shipleyr</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.robandhannah.co.uk/?p=251</guid>
		<description><![CDATA[Again another Zend Framework issue. I&#8217;ve been trying to work out how to detect if a current page is active when using zend navigation. I have setup an XML document with the navigation structure I am after but was having &#8230; <a href="http://blog.brainmassage.co.uk/2011/08/zend-navigations-isactive-method/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Again another Zend Framework issue. I&#8217;ve been trying to work out how to detect if a current page is active when using zend navigation. I have setup an XML document with the navigation structure I am after but was having problems detecting if a higher level node in the structure was the currently active branch.</p>
<p>Example:</p>
<pre>
Page 1
   Sub Page 1
   <b>Sub Page 2 - Currently active page</b>
   Sub Page 3
Page 2
Page 3
</pre>
<p>I was wanting to know when looking at the top level pages which one of Page 1, Page 2 or Page 3 was the current branch. I know the isActive() method exists for the current page but what I didn&#8217;t realise (and is not advertised on the send manual pages) is that passing the parameter &#8220;true&#8221; to the method makes is recursive.</p>
<p>By calling isActive(true) on the current node I was able to determine if the current branch I was looking at is the actual branch I require.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.brainmassage.co.uk/2011/08/zend-navigations-isactive-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Comment Spam</title>
		<link>http://blog.brainmassage.co.uk/2011/07/comment-spam/</link>
		<comments>http://blog.brainmassage.co.uk/2011/07/comment-spam/#comments</comments>
		<pubDate>Wed, 20 Jul 2011 08:55:01 +0000</pubDate>
		<dc:creator>shipleyr</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.robandhannah.co.uk/?p=247</guid>
		<description><![CDATA[I&#8217;m sorry to say that I&#8217;ve had to require registration before people are able to leave comments on this blog now. I&#8217;ve been getting a lot of comment spam so I&#8217;ve temporarily activated the requirement for registration before comments are &#8230; <a href="http://blog.brainmassage.co.uk/2011/07/comment-spam/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m sorry to say that I&#8217;ve had to require registration before people are able to leave comments on this blog now. I&#8217;ve been getting a lot of comment spam so I&#8217;ve temporarily activated the requirement for registration before comments are allowed until I&#8217;ve managed to put some form of protection in place.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.brainmassage.co.uk/2011/07/comment-spam/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend_Auth_Adapter with multiple identity columns (username and email)</title>
		<link>http://blog.brainmassage.co.uk/2011/05/zend_auth_adapter-with-multiple-identity-columns-username-and-email/</link>
		<comments>http://blog.brainmassage.co.uk/2011/05/zend_auth_adapter-with-multiple-identity-columns-username-and-email/#comments</comments>
		<pubDate>Tue, 03 May 2011 14:39:58 +0000</pubDate>
		<dc:creator>shipleyr</dc:creator>
				<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://blog.robandhannah.co.uk/?p=236</guid>
		<description><![CDATA[I&#8217;ve just started working with the Zend Framework and I must say it&#8217;s awesome. So powerful and so many helpers in place to make things easy to do. I&#8217;ve just been working with an authentication adapter. I wanted my users &#8230; <a href="http://blog.brainmassage.co.uk/2011/05/zend_auth_adapter-with-multiple-identity-columns-username-and-email/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just started working with the Zend Framework and I must say it&#8217;s awesome. So powerful and so many helpers in place to make things easy to do. I&#8217;ve just been working with an authentication adapter. I wanted my users to be able to login using either their username or email address and a password. Zend_Auth_Adapter_DbTable does a brilliant job of using one field (email or username) but does not allow you to use both.</p>
<p>To do this I&#8217;ve written an auth adapter which has allowed me to use both. It&#8217;s a very simple class that adds an additional where clause option with the additional field. See below for the code&#8230;</p>
<p>&nbsp;</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="php"><pre class="de1"><span class="kw2">class</span> ZendExt_Auth_Adapter_MultiColumnDbTable 
              <span class="kw2">extends</span> Zend_Auth_Adapter_DbTable
<span class="br0">&#123;</span>
  <span class="kw2">protected</span> <span class="re0">$_alternativeIdentityColumn</span> <span class="sy0">=</span> <span class="kw4">null</span><span class="sy0">;</span>
&nbsp;
  <span class="kw2">protected</span> <span class="kw2">function</span> _authenticateCreateSelect<span class="br0">&#40;</span><span class="br0">&#41;</span>
  <span class="br0">&#123;</span>
    <span class="re0">$select</span> <span class="sy0">=</span> parent<span class="sy0">::</span>_authenticateCreateSelect<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
    <span class="kw1">if</span><span class="br0">&#40;</span><span class="kw3">isset</span><span class="br0">&#40;</span><span class="re0">$this</span><span class="sy0">-&gt;</span>_alternativeIdentityColumn<span class="br0">&#41;</span><span class="br0">&#41;</span>
    <span class="br0">&#123;</span>
      <span class="re0">$select</span><span class="sy0">-&gt;</span><span class="me1">orWhere</span><span class="br0">&#40;</span><span class="re0">$this</span><span class="sy0">-&gt;</span>_zendDb<span class="sy0">-&gt;</span><span class="me1">quoteIdentifier</span><span class="br0">&#40;</span>
                      <span class="re0">$this</span><span class="sy0">-&gt;</span>_alternativeIdentityColumn<span class="sy0">,</span> <span class="kw4">true</span><span class="br0">&#41;</span> <span class="sy0">.</span> <span class="st_h">' = ?'</span><span class="sy0">,</span> 
                      <span class="re0">$this</span><span class="sy0">-&gt;</span>_identity<span class="br0">&#41;</span><span class="sy0">;</span>
    <span class="br0">&#125;</span>
&nbsp;
    <span class="kw1">return</span> <span class="re0">$select</span><span class="sy0">;</span>
  <span class="br0">&#125;</span>
&nbsp;
  <span class="kw2">public</span> <span class="kw2">function</span> setAlternativeIdentityColumn<span class="br0">&#40;</span><span class="re0">$alternativeIdentityColumn</span><span class="br0">&#41;</span>
  <span class="br0">&#123;</span>
    <span class="re0">$this</span><span class="sy0">-&gt;</span>_alternativeIdentityColumn <span class="sy0">=</span> <span class="re0">$alternativeIdentityColumn</span><span class="sy0">;</span>
    <span class="kw1">return</span> <span class="re0">$this</span><span class="sy0">;</span>
  <span class="br0">&#125;</span>
<span class="br0">&#125;</span></pre></div></div></div></div></div></div></div>


<p>Pretty simple really. The important line is the &#8220;orWhere&#8221; bit which adds the additional column you want to use.<br />
To use it you just have to do the following&#8230;</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="php"><pre class="de1"><span class="re0">$dbAdapter</span> <span class="sy0">=</span> Zend_Db_Table<span class="sy0">::</span><span class="me2">getDefaultAdapter</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="re0">$authAdapter</span> <span class="sy0">=</span> <span class="kw2">new</span> ZendExt_Auth_Adapter_MultiColumnDbTable<span class="br0">&#40;</span><span class="re0">$dbAdapter</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="re0">$authAdapter</span><span class="sy0">-&gt;</span><span class="me1">setTableName</span><span class="br0">&#40;</span><span class="st_h">'user_user'</span><span class="br0">&#41;</span>
  <span class="sy0">-&gt;</span><span class="me1">setIdentityColumn</span><span class="br0">&#40;</span><span class="st_h">'username'</span><span class="br0">&#41;</span>
  <span class="sy0">-&gt;</span><span class="me1">setAlternativeIdentityColumn</span><span class="br0">&#40;</span><span class="st_h">'email'</span><span class="br0">&#41;</span>
  <span class="sy0">-&gt;</span><span class="me1">setCredentialColumn</span><span class="br0">&#40;</span><span class="st_h">'password'</span><span class="br0">&#41;</span>
  <span class="sy0">-&gt;</span><span class="me1">setCredentialTreatment</span><span class="br0">&#40;</span><span class="st_h">'MD5(?)'</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div></div></div></div></div></div>


]]></content:encoded>
			<wfw:commentRss>http://blog.brainmassage.co.uk/2011/05/zend_auth_adapter-with-multiple-identity-columns-username-and-email/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deleted items in outlook end up in the wrong deleted items folder</title>
		<link>http://blog.brainmassage.co.uk/2011/04/deleted-items-in-outlook-end-up-in-the-wrong-deleted-items-folder/</link>
		<comments>http://blog.brainmassage.co.uk/2011/04/deleted-items-in-outlook-end-up-in-the-wrong-deleted-items-folder/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 15:42:42 +0000</pubDate>
		<dc:creator>shipleyr</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.robandhannah.co.uk/?p=228</guid>
		<description><![CDATA[I&#8217;ve recently stared monitoring a mailbox for errors on a website. When an error occurs it sends an email to a Tech Support mail box. When I check through this box there are several emails that are from known sources &#8230; <a href="http://blog.brainmassage.co.uk/2011/04/deleted-items-in-outlook-end-up-in-the-wrong-deleted-items-folder/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently stared monitoring a mailbox for errors on a website. When an error occurs it sends an email to a Tech Support mail box. When I check through this box there are several emails that are from known sources and I like to clean the box down. When I do this however all the deleted items end up in my own mailboxes deleted items folder! This is not what I want to happen.</p>
<p>There is a solution to this however that requires a little bit of registry modification. If you set values as outlined below the deleted items will end up in the box of the person you deleted it from.</p>
<p>Key: HKEY_CURRENT_USER\Software\Microsoft\Office\<em>xx.x</em>\Outlook\Options\General<br />
Value name: DelegateWastebasketStyle<br />
Value Type: REG_DWORD<br />
Value: 4</p>
<p>Note the xx.x should relate to the version of outlook you are using. For Outlook 2010 this is 14.0, for outlook 2007 this is 12.0</p>
<p>Credit for this goes to: <a href="http://www.msoutlook.info/question/130">http://www.msoutlook.info/question/130</a></p>
<p>UPDATE:</p>
<p>There is a similar fix for sent items. If you follow the instructions as listed in this MS KB article: <a href="http://support.microsoft.com/kb/972148">http://support.microsoft.com/kb/972148</a></p>
<p>For outlook 2010 see: <a href="http://social.technet.microsoft.com/Forums/en/outlook/thread/4d38fdb9-e85b-4eac-b1b1-553e01bf168e">http://social.technet.microsoft.com/Forums/en/outlook/thread/4d38fdb9-e85b-4eac-b1b1-553e01bf168e</a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.brainmassage.co.uk/2011/04/deleted-items-in-outlook-end-up-in-the-wrong-deleted-items-folder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NASA Desktop Theme for Windows 7</title>
		<link>http://blog.brainmassage.co.uk/2011/02/nasa-desktop-theme-for-windows-7/</link>
		<comments>http://blog.brainmassage.co.uk/2011/02/nasa-desktop-theme-for-windows-7/#comments</comments>
		<pubDate>Sat, 26 Feb 2011 20:57:19 +0000</pubDate>
		<dc:creator>shipleyr</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.robandhannah.co.uk/?p=225</guid>
		<description><![CDATA[Lots of people probably already know that it is possible for you to have a slide show as your desktop background. What a lot of people probably don&#8217;t know is that you can have an RSS feed as your desktop. &#8230; <a href="http://blog.brainmassage.co.uk/2011/02/nasa-desktop-theme-for-windows-7/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Lots of people probably already know that it is possible for you to have a slide show as your desktop background. What a lot of people probably don&#8217;t know is that you can have an RSS feed as your desktop. For example, you can use something like the nasa daily theme.</p>
<p>I&#8217;ve just created a theme for with the help of <a href="http://www.online-tech-tips.com/windows-7/rotate-windows-7-wallpaper-automatically-via-rss-feed/">this article</a>. I&#8217;ve modified it slightly to use the nasa large image of the day at: <a href="http://www.nasa.gov/rss/lg_image_of_the_day.rss">http://www.nasa.gov/rss/lg_image_of_the_day.rss</a></p>
<p>If you want to use this theme. See here: <a href="http://blog.robandhannah.co.uk/wp-content/uploads/2011/02/NASA.zip">NASA Theme</a>. Simply download it, unzip it and double click on it. When asked, say you want to download the elements of the RSS theme. It may take some time to download the images so if you don&#8217;t get a background straight away try switching the theme and back again.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.brainmassage.co.uk/2011/02/nasa-desktop-theme-for-windows-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>No Virtual Mahines were found on this server</title>
		<link>http://blog.brainmassage.co.uk/2011/02/no-virtual-mahines-were-found-on-this-server/</link>
		<comments>http://blog.brainmassage.co.uk/2011/02/no-virtual-mahines-were-found-on-this-server/#comments</comments>
		<pubDate>Fri, 18 Feb 2011 16:45:21 +0000</pubDate>
		<dc:creator>shipleyr</dc:creator>
				<category><![CDATA[Virtualisation]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://blog.robandhannah.co.uk/?p=217</guid>
		<description><![CDATA[Right&#8230; This has been driving me crazy today. Not really sure why it happened but I&#8217;ve managed to sort if out now and wanted to share! Our hyper-v server hosting our domain controller and a couple of Linux machines decided &#8230; <a href="http://blog.brainmassage.co.uk/2011/02/no-virtual-mahines-were-found-on-this-server/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Right&#8230; This has been driving me crazy today. Not really sure why it happened but I&#8217;ve managed to sort if out now and wanted to share!</p>
<p>Our hyper-v server hosting our domain controller and a couple of Linux machines decided today that it didn&#8217;t want to admit to having any machines hosted on it. When opening hte hyper-v management tools on my Win 7 laptop I was getting the message &#8220;No Virtual Mahines were found on this server&#8221;. That was quite a worry and made me reluctant to re-boot the host machine through fear of not being able to control the hosted machines any more.</p>
<p>My first hurdle was getting access to the Hyper-v R2 Event Log. For some reason the firewall was not configured to allow me to access this. This was a simple fix of opening the fiewall on the hyper-v server to allow WMI access. The alternative is to drop the fire wall for the duration of this fix (<span style="font-family: courier new;">netsh firewall set opmode disable</span>) and re-enable it after (<span style="font-family: courier new;">netsh firewall set opmode enable</span>).</p>
<p>Ok the real crux of the problem. For some reason the security permissions on the hyper-v configuration files had been lost or reset. It took me an age to fix this but finally managed to piece together enough information to fix it.</p>
<p>The Virtual Machine Management Service uses some configuration files from the directory <span style="font-family: courier new;">%SYSTEMDRIVE%\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines\</span>. The xml files in this directory are in fact symlinks and should be named the same as the xml configuration files for the virtual machines them selves.</p>
<p>We store our virtual machines in the directory <span style="font-family: courier new;">v:\VMs</span>. So for example our machine test-01 has it&#8217;s xml file stored as <span style="font-family: courier new;">V:\VMs\test-01\Virtual Machines\&lt;guid&gt;.xml</span>.</p>
<p>Each virtual machine on the host has a similar set up. To fix the permissions you need to recreate the symlinks in the directory <span style="font-family: courier new;">%SYSTEMDRIVE%\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines\</span>. To do that you need to execute the following commands for each machine.</p>
<p><span style="font-family: courier new;">mklink &#8220;%SYSTEMDRIVE%\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines\&lt;vm_guid&gt;.xml&#8221; &#8220;V:\VMs\win2k8r2\Virtual Machines\&lt;vm_guid&gt;.xml&#8221;</span></p>
<p><span style="font-family: courier new;">icacls &#8220;%SYSTEMDRIVE%\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines\&lt;vm_guid&gt;.xml&#8221; /grant &#8220;NT VIRTUAL MACHINE\&lt;vm_guid&gt;&#8221;:F /l</span></p>
<p>The one part that I missed initially was the &#8220;/l&#8221; on the end of the icacls command. This is very important and tells icacls to apply the security permission to the link rather than the destination file.</p>
<p>If any of your VM&#8217;s have snapshots you need to repeat a similar procedure for the snapshots directory.</p>
<p><span style="font-family: courier new;">mklink &#8220;%SYSTEMDRIVE%\ProgramData\Microsoft\Windows\Hyper-V\Snapshots\&lt;snapshot_guid&gt;.xml&#8221; &#8220;V:\VMs\test-01\Snapshots\&lt;snapshot_guid&gt;.xml&#8221;</span></p>
<p><span style="font-family: courier new;">icacls &#8220;%SYSTEMDRIVE%\ProgramData\Microsoft\Windows\Hyper-V\Snapshots\&lt;snapshot_guid&gt;.xml&#8221; /grant &#8220;NT VIRTUAL MACHINE\&lt;vm_guid&gt;&#8221;:F /l</span></p>
<p>When you have repaired all the files in the directories simply restart the Virtual Machine Management Service&#8221; by using the following two commands:</p>
<p><span style="font-family: courier new;">net stop vmms</span></p>
<p><span style="font-family: courier new;">net start vmms</span></p>
<p>You should now be able to view the files in the Hyper-v management console.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.brainmassage.co.uk/2011/02/no-virtual-mahines-were-found-on-this-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SBS Migration &#8211; Part 2: Data Migration</title>
		<link>http://blog.brainmassage.co.uk/2011/02/sbs-migration-part-2-data-migration/</link>
		<comments>http://blog.brainmassage.co.uk/2011/02/sbs-migration-part-2-data-migration/#comments</comments>
		<pubDate>Sun, 13 Feb 2011 15:22:06 +0000</pubDate>
		<dc:creator>shipleyr</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.robandhannah.co.uk/?p=215</guid>
		<description><![CDATA[As part of our setup we have a branch office server running Server 2008 R2. To ensure data was kept in sync between the two servers we setup some data replication namespaces and replication groups. This certainly makes replicating data &#8230; <a href="http://blog.brainmassage.co.uk/2011/02/sbs-migration-part-2-data-migration/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>As part of our setup we have a branch office server running Server 2008 R2. To ensure data was kept in sync between the two servers we setup some data replication namespaces and replication groups. This certainly makes replicating data to the new server a lot easier and allows a slightly more piecemeal approach to the migration.</p>
<p>To begin with I&#8217;ve setup the new server as another member of the replication group and replicating with the server it is replacing. I did it this way because both machines are virtual and are running on a Hyper-V host. Between the two servers in the virtual environment is a 10 Gigabit network (speedy!!). This will allow fast replication of the data between the two servers.</p>
<p>All users redirected data is accessed via a domain namespace. For example \\mydomain.local\Users\&lt;username&gt;. This again aids the transfer process. When we have low server usage one weekend I plan to re-structure the replication groups and namespaces. As all the data is kept in sync between the servers, when everything is sync&#8217;ed I can simply change the replication to replicate to the branch server from the new server as well and remove the old server from the list. This will then mean all users data and shares (again accessed by the namespace) will be being accessed from the new server.</p>
<p>1 very large step closer to the completion of the migration.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.brainmassage.co.uk/2011/02/sbs-migration-part-2-data-migration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Small Business Server 2011 Migration</title>
		<link>http://blog.brainmassage.co.uk/2011/02/small-business-server-2011-migration/</link>
		<comments>http://blog.brainmassage.co.uk/2011/02/small-business-server-2011-migration/#comments</comments>
		<pubDate>Sun, 13 Feb 2011 10:46:53 +0000</pubDate>
		<dc:creator>shipleyr</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.robandhannah.co.uk/?p=211</guid>
		<description><![CDATA[We are in the process of migrating our server at work from Windows Small Business Server 2008 to Small Business Server 2011. There is a good article on the microsft site for working through this process. I&#8217;d recommend reading this &#8230; <a href="http://blog.brainmassage.co.uk/2011/02/small-business-server-2011-migration/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>We are in the process of migrating our server at work from Windows Small Business Server 2008 to Small Business Server 2011. There is a good article on the microsft site for working through this process. I&#8217;d recommend reading this if you are doing a similar migration (<a href="http://technet.microsoft.com/en-us/library/gg615506.aspx">http://technet.microsoft.com/en-us/library/gg615506.aspx</a>).</p>
<p>I&#8217;m planning on writing a few articles about the process of doing this migration. As a starting note I&#8217;m just going to give a note on starting the process. One of the first things to do is install the new version of the server in migration mode. To achieve this you need to create a set up answer file. This set up file needs to be placed on the root of any drive connected to the server. In our case we were installing the new server on a Hyper-v virtualisation server. The quickest way of achieving this is to create a small virtual hard disk and add the file to this.</p>
<p>The point we stumbled on was not reading the manual (aren&#8217;t all techies guilty of this from time to time!). The answer file needs to be called sbsanswerfile.xml or unattended.xml. We had not called the file this and was not being detected on the drive.</p>
<p>I&#8217;ll post more progress updates when we get further down the line!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.brainmassage.co.uk/2011/02/small-business-server-2011-migration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

