<?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>Machine learning &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/machine-learning/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>on web development</description>
	<lastBuildDate>Tue, 13 Feb 2018 08:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>Bind Zend Action with Non-Default View</title>
		<link>/2010/06/07/bind-zend-action-with-non-default-view/</link>
		<comments>/2010/06/07/bind-zend-action-with-non-default-view/#respond</comments>
		<pubDate>Mon, 07 Jun 2010 14:50:55 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[_forward]]></category>
		<category><![CDATA[Machine learning]]></category>
		<category><![CDATA[Quantum mechanics]]></category>
		<category><![CDATA[Theoretical computer science]]></category>

		<guid isPermaLink="false">/?p=1595</guid>
		<description><![CDATA[Action &#8211; View You may know that every controller&#8217;s action in Zend Framework has to be bind to a view. Normally you can disable the view for a specific action, but how about &#8220;forking&#8221; an action to render different views?! In example when some _GET parameter is set redirect to another view? That&#8217;s rather strange &#8230; <a href="/2010/06/07/bind-zend-action-with-non-default-view/" class="more-link">Continue reading <span class="screen-reader-text">Bind Zend Action with Non-Default View</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/06/23/bind-zend-action-with-non-default-view-part-2/" rel="bookmark" title="Bind Zend Action with Non-Default View &#8211; Part 2">Bind Zend Action with Non-Default View &#8211; Part 2 </a></li>
<li><a href="/2010/06/16/zend-examples-get-parameters-default-value/" rel="bookmark" title="Zend Examples: GET Parameters Default Value">Zend Examples: GET Parameters Default Value </a></li>
<li><a href="/2010/06/24/zend-framework-inject-javascript-code-in-a-actionview/" rel="bookmark" title="Zend Framework: Inject JavaScript Code in a Action/View">Zend Framework: Inject JavaScript Code in a Action/View </a></li>
<li><a href="/2010/01/29/escaping-strings-in-a-zend-framework-view-prevent-unclosed-tags/" rel="bookmark" title="Escaping strings in a Zend Framework view. Prevent unclosed tags!">Escaping strings in a Zend Framework view. Prevent unclosed tags! </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Action &#8211; View</h2>
<p>You may know that every controller&#8217;s action in Zend Framework has to be bind to a view. Normally you can disable the view for a specific action, but how about &#8220;forking&#8221; an action to render different views?!</p>
<p>In example when some _GET parameter is set redirect to another view? That&#8217;s rather strange and perhaps there&#8217;s a clear and yet full MVC solution! First of all you can setup all of the view variables simply in the &#8220;parent&#8221; action.</p>
<pre lang="php">
<?php

class IndexController extends Zend_Controller_Action
{
	public function indexAction()
	{
		$this->view->title = 'This is the default action!';	
	}
}

</pre>
<p>Than the view file will contain something like:</p>
<pre lang="php">
// index/index.phtml
<h1><?php echo $this->title ?></h1>
</pre>
<p>Than whenever you have the given _GET set you can _forward to another action (perhaps with no code at all) and only a different view. Thus you don&#8217;t setup twice the view variables.</p>
<pre lang="php">
<?php

class IndexController extends Zend_Controller_Action
{
	public function indexAction()
	{
		$this->view->title = 'This is the default action!';	
		
		if (isset($_GET['my_param'])) {
			$this->_forward('another');
		}
	}
	
	public function anotherAction()
	{}
}
</pre>
<p>And there are two views practically for one action:</p>
<pre lang="php">
// index/index.phtml
<h1><?php echo $this->title ?></h1>

// index/another.phtml
<h2><?php echo $this->title ?></h2>
</pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/06/23/bind-zend-action-with-non-default-view-part-2/" rel="bookmark" title="Bind Zend Action with Non-Default View &#8211; Part 2">Bind Zend Action with Non-Default View &#8211; Part 2 </a></li>
<li><a href="/2010/06/16/zend-examples-get-parameters-default-value/" rel="bookmark" title="Zend Examples: GET Parameters Default Value">Zend Examples: GET Parameters Default Value </a></li>
<li><a href="/2010/06/24/zend-framework-inject-javascript-code-in-a-actionview/" rel="bookmark" title="Zend Framework: Inject JavaScript Code in a Action/View">Zend Framework: Inject JavaScript Code in a Action/View </a></li>
<li><a href="/2010/01/29/escaping-strings-in-a-zend-framework-view-prevent-unclosed-tags/" rel="bookmark" title="Escaping strings in a Zend Framework view. Prevent unclosed tags!">Escaping strings in a Zend Framework view. Prevent unclosed tags! </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/06/07/bind-zend-action-with-non-default-view/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
