<?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>Zend Technologies &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/zend-technologies/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>POST with Zend_Http_Client</title>
		<link>/2011/04/13/post-with-zend_http_client/</link>
		<comments>/2011/04/13/post-with-zend_http_client/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 13:26:47 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[Computer networking]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[CURL]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[Hypertext Transfer Protocol]]></category>
		<category><![CDATA[Internet protocols]]></category>
		<category><![CDATA[Network protocols]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[World Wide Web]]></category>
		<category><![CDATA[Zend Technologies]]></category>

		<guid isPermaLink="false">/?p=2299</guid>
		<description><![CDATA[CURL and Zend_Http It&#8217;s a well know fact that you can preform HTTP requests with CURL. Zend Framework does the same job with Zend_Http. Especially Zend_Http_Client can be used to &#8220;replace&#8221; the usual client &#8211; the browser, and to perform some basic requests. I&#8217;ve seen mostly GET requests, although Zend_Http_Client can perform various requests such &#8230; <a href="/2011/04/13/post-with-zend_http_client/" class="more-link">Continue reading <span class="screen-reader-text">POST with Zend_Http_Client</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/06/28/send-authenticated-post-request-with-zend_http_client/" rel="bookmark" title="Send Authenticated POST Request with Zend_Http_Client">Send Authenticated POST Request with Zend_Http_Client </a></li>
<li><a href="/2010/04/14/zend_http_client-and-case-sensitivity/" rel="bookmark" title="Zend_Http_Client and Case Sensitivity">Zend_Http_Client and Case Sensitivity </a></li>
<li><a href="/2010/03/23/read-remote-file-content-type-with-zend_http_client/" rel="bookmark" title="Read Remote File Content-Type with Zend_Http_Client">Read Remote File Content-Type with Zend_Http_Client </a></li>
<li><a href="/2011/04/07/use-fopen-to-check-file-availability/" rel="bookmark" title="Use fopen() to Check File Availability?">Use fopen() to Check File Availability? </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>CURL and Zend_Http</h2>
<p>It&#8217;s a well know fact that you can preform <a title="Http Requests - the Hypertext Transfer Protocol" href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol" target="_blank">HTTP requests</a> with <a href="http://en.wikipedia.org/wiki/CURL" title="CURL" target="_blank">CURL</a>. <a title="Zend Framework" href="http://framework.zend.com/" target="_blank">Zend Framework</a> does the same job with <a title="Zend_Http" href="http://framework.zend.com/manual/en/zend.http.html" target="_blank">Zend_Http</a>. Especially <a title="Http on Stoimen.com" href="/tag/http/">Zend_Http_Client</a> can be used to &#8220;replace&#8221; the usual client &#8211; the browser, and to perform some basic requests.</p>
<figure id="attachment_2308" style="width: 450px" class="wp-caption aligncenter"><a href="/wp-content/uploads/2011/04/http.jpg"><img class="size-full wp-image-2308" title="HTTP requests can be performed with Zend_Http_Client" src="/wp-content/uploads/2011/04/http.jpg" alt="HTTP requests can be performed with Zend_Http_Client" width="450" height="337" srcset="/wp-content/uploads/2011/04/http.jpg 450w, /wp-content/uploads/2011/04/http-300x224.jpg 300w" sizes="(max-width: 450px) 100vw, 450px" /></a><figcaption class="wp-caption-text">Zend_Http_Client is mostly used to perform GET requests, but it can be also very helpful for POST HTTP requests.</figcaption></figure>
<p>I&#8217;ve seen mostly GET requests, although Zend_Http_Client can perform various requests such as <a title="POST Requests on Stoimen.com" href="/tag/post/">POST</a> as well.</p>
<pre lang="php">
// new HTTP request to some HTTP address
$httpClient = new Zend_Http_Client('http://www.example.com/');
// GET the response
$response = $httpClient->request(Zend_Http_Client::GET);
</pre>
<p>Here&#8217;s a little snippet showing how to POST some data to a server.</p>
<pre lang="php">
// new HTTP request to some HTTP address
$client = new Zend_Http_Client('http://www.example.com/');
// set some parameters
$client->setParameterPost('name', 'value');
// POST request
$response = $client->request(Zend_Http_Client::POST);
</pre>
<p>Note that the request method returns a response. Thus if you are simulating a form submit action you can &#8220;redirect&#8221; to the desired page just like the form.</p>
<pre lang="php">
// new HTTP request to some HTTP address
$client = new Zend_Http_Client('http://www.example.com/');
// set some parameters
$client->setParameterPost('name', 'value');
// POST request
$response = $client->request(Zend_Http_Client::POST);
echo $response->location;
</pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/06/28/send-authenticated-post-request-with-zend_http_client/" rel="bookmark" title="Send Authenticated POST Request with Zend_Http_Client">Send Authenticated POST Request with Zend_Http_Client </a></li>
<li><a href="/2010/04/14/zend_http_client-and-case-sensitivity/" rel="bookmark" title="Zend_Http_Client and Case Sensitivity">Zend_Http_Client and Case Sensitivity </a></li>
<li><a href="/2010/03/23/read-remote-file-content-type-with-zend_http_client/" rel="bookmark" title="Read Remote File Content-Type with Zend_Http_Client">Read Remote File Content-Type with Zend_Http_Client </a></li>
<li><a href="/2011/04/07/use-fopen-to-check-file-availability/" rel="bookmark" title="Use fopen() to Check File Availability?">Use fopen() to Check File Availability? </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2011/04/13/post-with-zend_http_client/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Overcome Zend_Cache_Frontend_Page&#8217;s Problem with Cookies</title>
		<link>/2010/11/03/how-to-overcome-zend_cache_frontend_pages-problem-with-cookies/</link>
		<comments>/2010/11/03/how-to-overcome-zend_cache_frontend_pages-problem-with-cookies/#comments</comments>
		<pubDate>Wed, 03 Nov 2010 14:19:25 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[Apache Corporation]]></category>
		<category><![CDATA[Cache]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[Computer memory]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[CPU cache]]></category>
		<category><![CDATA[Cross-platform software]]></category>
		<category><![CDATA[database server]]></category>
		<category><![CDATA[Google Inc.]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[HTTP cookie]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[MySQL Americas Inc.]]></category>
		<category><![CDATA[Page cache]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[script interpreter]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[web app]]></category>
		<category><![CDATA[web application caching]]></category>
		<category><![CDATA[Web application frameworks]]></category>
		<category><![CDATA[web server]]></category>
		<category><![CDATA[Zend Technologies]]></category>

		<guid isPermaLink="false">/?p=2024</guid>
		<description><![CDATA[Zend_Cache_Frontend_Page First of all there are several things to know about Zend Framework and caching. Whenever you work on a big web application caching is one of the mostly used mechanisms of speeding up the app and improve user performance. In general the task and the solution are pretty simple and natural. As the application &#8230; <a href="/2010/11/03/how-to-overcome-zend_cache_frontend_pages-problem-with-cookies/" class="more-link">Continue reading <span class="screen-reader-text">How to Overcome Zend_Cache_Frontend_Page&#8217;s Problem with Cookies</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2011/01/17/a-memcached-zend_cache/" rel="bookmark" title="A Memcached Zend_Cache">A Memcached Zend_Cache </a></li>
<li><a href="/2010/01/27/theory-of-caching-zend_cache-zend-optimizer/" rel="bookmark" title="Theory of caching. Zend_Cache &#038; Zend Optimizer.">Theory of caching. Zend_Cache &#038; Zend Optimizer. </a></li>
<li><a href="/2010/07/21/setting-up-global-cache-in-zend-framework/" rel="bookmark" title="Setting Up Global Cache in Zend Framework">Setting Up Global Cache in Zend Framework </a></li>
<li><a href="/2010/07/19/zend-framework-cache-database-table-schemes/" rel="bookmark" title="Zend Framework: Cache Database Table Schemes">Zend Framework: Cache Database Table Schemes </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Zend_Cache_Frontend_Page</h2>
<p>First of all there are several things to know about Zend Framework and caching. Whenever you work on a big web application caching is one of the mostly used mechanisms of speeding up the app and improve user performance. In general the task and the solution are pretty simple and natural.</p>
<p>As the application grows up the visitors become more and more impatient about what they receive. A single page is becoming slower and slower and the result is painful. First of all every time a user hits a page the application server uses the web server, a script interpreter, a database server and potentially the file system. But that&#8217;s not all. After all this output is generated on the server, as HTML in the most cases, it is sent to the client where again CSS and JavaScript engines parse and execute them.</p>
<p>In this scenario it&#8217;s easy to imagine how many time is spent. While there are several techniques to optimize the client side by optimizing JavaScript, CSS and the static images used for the design of the site, here I&#8217;m going to talk more about the backend.</p>
<h2>Beside the Optimization</h2>
<p>Let&#8217;s assume we&#8217;ve one of the very used combination between Apache (as a webserver), PHP (as server scripting language) and MySQL (as database server). Here you can choose to optimize all three of them. However beside the optimization of them one of the most simple steps you can do is to cache the output generated by these three branches of your web app.</p>
<h2>Caching the Content</h2>
<p>In fact you can cache only single parts of the whole process. For instance you can cache only the result returned by some slow database query. Let&#8217;s imagine a query takes about 2 seconds to execute. Now you can cache the result into a file and during the cache is active, i.e. it has not expired, the application takes it from a file stored somewhere in the file system.</p>
<p>In a typical Zend Framework scenario you can first setup the frontend and backend options of the cache.</p>
<pre lang="php">
$frontendOptions = array(
	'lifetime'                => 600, // in seconds - this is 10 seconds
	'automatic_serialization' => true,
);
$backendOptions = array('cache_dir' => 'cache/');
$cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
		
$cacheKey = md5('mykey');

if (!$cache->load($cacheKey)) {
	$slowQueryResult = $article->fetchAll();
	$cache->save($slowQueryResult, $cacheKey);
} else {
	$slowQueryResult = $cache->load($cacheKey);
}
</pre>
<p>You can setup different options here by setting up the cache directory, lifetime, etc.</p>
<p><em>Note that the cache directory must exists and with write permissions and Zend Framework doesn&#8217;t create it for you and will throw error.</em></p>
<p>The problem here is that now you cache only part of the generated content and in many cases this is still too slow for most of the users. However all the work (in most of the cases) of the web server, the script interpreter and the database server result in a simple HTML output. What if you have this output generated or cached for you and when the user hit the page the server will return this pre-generated code?</p>
<p>This is indeed very fast, because it&#8217;s similar to return a text file, as the HTML is simply formatted text.</p>
<h2>Caching the Entire Page</h2>
<p>Before I proceed, I&#8217;d like to say that I work with Zend Framework 1.9.x. Now in the latest versions of ZF there are new mechanisms of caching the output even Zend_Cache_Frontend_Page works fine on them.</p>
<p>You can simply setup the page cache within few simple lines of code:</p>
<pre lang="php">
$fo = array(
    'lifetime' => 600,
    'regexps' => array(
        '^/' => array(
	'cache' => true,
         'cache_with_cookie_variables' => true,
        ),
    )
);

$bo = array(
    'cache_dir' => 'cache/'
);

$cache = Zend_Cache::factory('Page', 'File', $fo, $bo);
$cache->start();
</pre>
<p>However my advise is to place this code as high as possible, because this will cache everything generated as output. It&#8217;s a good practice if you place this even in the bootstrap before you make the connection with the database. Actually you don&#8217;t need a database connection when you&#8217;ve to return a simple text(html) file.</p>
<p>This will improve your app&#8217;s performance a lot!</p>
<p>However there are few things to know. When you setup the cache to work even with cookie variables, you can see that hitting the page with different browsers Zend Framework will generated different cache pages. This is quite useless because than you don&#8217;t have any benefit of caching the content.</p>
<p>First of all let me say that THIS IS NOT A BUG! of ZF. Simply the framework will use the cookie variables to generate the cache key. It&#8217;s obvious that different browsers, even more different users, will have different cookie set and the framework will generate different cache keys for them.</p>
<p>Thus you&#8217;ve to change the setting to generate the cache key from cookie variable by explicitly set this option to false:</p>
<pre lang="php">
$fo = array(
    'lifetime' => 600,
    'regexps' => array(
        '^/' => array(
		 'cache' => true,
         'cache_with_cookie_variables' => true,
         'make_id_with_cookie_variables' => false,
        ),
    )
);

$bo = array(
    'cache_dir' => 'cache/'
);

$cache = Zend_Cache::factory('Page', 'File', $fo, $bo);
$cache->start();
</pre>
<p>Note that in this example we cache every single page generated by the framework explained in the regexps. This is not so good especially when the users have the possibility to login and to see customized content for them, so you can be careful what you cache.</p>
<p>A typical problem that this solution solves is when your application uses Google Analytics. As you may know Google Analytics sets up a cookie every time when an user hits the page, so every time the framework will generate a different cache for him and in result he won&#8217;t see any benefit and performance improvement from your site.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2011/01/17/a-memcached-zend_cache/" rel="bookmark" title="A Memcached Zend_Cache">A Memcached Zend_Cache </a></li>
<li><a href="/2010/01/27/theory-of-caching-zend_cache-zend-optimizer/" rel="bookmark" title="Theory of caching. Zend_Cache &#038; Zend Optimizer.">Theory of caching. Zend_Cache &#038; Zend Optimizer. </a></li>
<li><a href="/2010/07/21/setting-up-global-cache-in-zend-framework/" rel="bookmark" title="Setting Up Global Cache in Zend Framework">Setting Up Global Cache in Zend Framework </a></li>
<li><a href="/2010/07/19/zend-framework-cache-database-table-schemes/" rel="bookmark" title="Zend Framework: Cache Database Table Schemes">Zend Framework: Cache Database Table Schemes </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/11/03/how-to-overcome-zend_cache_frontend_pages-problem-with-cookies/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Setting Up Global Cache in Zend Framework</title>
		<link>/2010/07/21/setting-up-global-cache-in-zend-framework/</link>
		<comments>/2010/07/21/setting-up-global-cache-in-zend-framework/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 11:17:48 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[Computer programming]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[controller]]></category>
		<category><![CDATA[Front Controller pattern]]></category>
		<category><![CDATA[Human Interest]]></category>
		<category><![CDATA[large scale web application]]></category>
		<category><![CDATA[PHP For Applications]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[Software engineering]]></category>
		<category><![CDATA[Software framework]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[Zend Technologies]]></category>

		<guid isPermaLink="false">/?p=1830</guid>
		<description><![CDATA[In a large scale web application, especially based on Zend Framework, there are lot&#8217;s of components that support built in cache support. Such are Zend_Db, Zend_Translate, Zend_Date, etc. Also you may need cache support wherever in the app, so my advice is to setup a cache instance in the &#8220;beginning&#8221;, into the bootstrap.php or even &#8230; <a href="/2010/07/21/setting-up-global-cache-in-zend-framework/" class="more-link">Continue reading <span class="screen-reader-text">Setting Up Global Cache in Zend Framework</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/07/19/zend-framework-cache-database-table-schemes/" rel="bookmark" title="Zend Framework: Cache Database Table Schemes">Zend Framework: Cache Database Table Schemes </a></li>
<li><a href="/2010/08/06/setting-up-zend-framework-with-modules/" rel="bookmark" title="Setting Up Zend Framework with Modules">Setting Up Zend Framework with Modules </a></li>
<li><a href="/2010/01/27/theory-of-caching-zend_cache-zend-optimizer/" rel="bookmark" title="Theory of caching. Zend_Cache &#038; Zend Optimizer.">Theory of caching. Zend_Cache &#038; Zend Optimizer. </a></li>
<li><a href="/2010/08/09/models-in-zend-framework-initialize-all-methods-with-init/" rel="bookmark" title="Models in Zend Framework &#8211; Initialize All Methods with init()">Models in Zend Framework &#8211; Initialize All Methods with init() </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>In a large scale web application, especially based on Zend Framework, there are lot&#8217;s of components that support built in cache support. Such are <a href="http://framework.zend.com/manual/en/zend.db.html">Zend_Db</a>, <a href="http://zendframework.com/manual/en/zend.translate.html">Zend_Translate</a>, <a href="http://framework.zend.com/manual/en/zend.date.html">Zend_Date</a>, etc. Also you may need cache support wherever in the app, so my advice is to setup a cache instance in the &#8220;beginning&#8221;, into the bootstrap.php or even better &#8211; into a front controller plugin, and to store it into the Zend_Registry. Thus you&#8217;ve to change only the lifetime for specific needs:</p>
<pre lang="php">
<?php

class CacheInit extends Zend_Controller_Plugin_Abstract
{
    public function __construct()
    {
        $frontendOptions = array(
            'automatic_serialization' => true,
            'lifetime' => 60
        );

        $backendOptions  = array(
            'cache_dir' => realpath(APPLICATION_PATH . '/../cache')
        );

        $cache = Zend_Cache::factory('Core',
                                     'File',
                                     $frontendOptions,
                                     $backendOptions);

        Zend_Registry::set('cache', $cache);
    }
}
</pre>
<p>Than add it as a front controller plugin:</p>
<pre lang="php">
// cache plugin
$frontController->registerPlugin(new CacheInit());
</pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/07/19/zend-framework-cache-database-table-schemes/" rel="bookmark" title="Zend Framework: Cache Database Table Schemes">Zend Framework: Cache Database Table Schemes </a></li>
<li><a href="/2010/08/06/setting-up-zend-framework-with-modules/" rel="bookmark" title="Setting Up Zend Framework with Modules">Setting Up Zend Framework with Modules </a></li>
<li><a href="/2010/01/27/theory-of-caching-zend_cache-zend-optimizer/" rel="bookmark" title="Theory of caching. Zend_Cache &#038; Zend Optimizer.">Theory of caching. Zend_Cache &#038; Zend Optimizer. </a></li>
<li><a href="/2010/08/09/models-in-zend-framework-initialize-all-methods-with-init/" rel="bookmark" title="Models in Zend Framework &#8211; Initialize All Methods with init()">Models in Zend Framework &#8211; Initialize All Methods with init() </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/07/21/setting-up-global-cache-in-zend-framework/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Zend Framework and Media RSS</title>
		<link>/2010/07/13/zend-framework-and-media-rss/</link>
		<comments>/2010/07/13/zend-framework-and-media-rss/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 19:23:32 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[Computer file formats]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Content syndication markup language]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[possible solutions]]></category>
		<category><![CDATA[RSS]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[World Wide Web]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[zend]]></category>
		<category><![CDATA[Zend Technologies]]></category>

		<guid isPermaLink="false">/?p=1795</guid>
		<description><![CDATA[The Problem Since native RSS format is not designed to deliver media content, there is a need for newer format supporting video and audio. There is such format &#8211; Media RSS introduced by Yahoo! in 2004. Actually now RSS supports some king of pseudo audio and video with the enclosure tag. Although there is a &#8230; <a href="/2010/07/13/zend-framework-and-media-rss/" class="more-link">Continue reading <span class="screen-reader-text">Zend Framework and Media RSS</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/07/14/media-rss-and-zf-part-2/" rel="bookmark" title="Media RSS and ZF &#8211; Part 2">Media RSS and ZF &#8211; Part 2 </a></li>
<li><a href="/2010/04/28/zend_datesetoptions-and-format_type-in-zend-framework-1-10-3/" rel="bookmark" title="Zend_Date::setOptions and format_type in Zend Framework 1.10.3">Zend_Date::setOptions and format_type in Zend Framework 1.10.3 </a></li>
<li><a href="/2010/04/30/burn-feeds-in-zend-framework/" rel="bookmark" title="Burn Feeds in Zend Framework">Burn Feeds in Zend Framework </a></li>
<li><a href="/2010/08/23/can-twitter-replace-the-rss-feed-readers/" rel="bookmark" title="Can Twitter Replace the RSS Feed Readers">Can Twitter Replace the RSS Feed Readers </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>The Problem</h2>
<p>Since native RSS format is not designed to deliver media content, there is a need for newer format supporting video and audio. There is such format &#8211; <a title="Media Rss Yahoo!" href="http://video.search.yahoo.com/mrss" target="_blank">Media RSS</a> introduced by Yahoo! in 2004. Actually now RSS supports some king of pseudo audio and video with the enclosure tag.</p>
<p><a href="/wp-content/uploads/2010/07/radio-media.jpeg"><img class="aligncenter size-full wp-image-1804" title="Radio Set" src="/wp-content/uploads/2010/07/radio-media.jpeg" alt="Inserting Media In RSS with Media RSS" width="430" height="322" srcset="/wp-content/uploads/2010/07/radio-media.jpeg 430w, /wp-content/uploads/2010/07/radio-media-300x224.jpg 300w" sizes="(max-width: 430px) 100vw, 430px" /></a></p>
<p>Although there is a standardized format, there is not a Zend Framework native module. There is however a <a title="Zend Framework and Media RSS" href="http://framework.zend.com/wiki/display/ZFPROP/Zend_Feed_Writer_Extension_MediaRSS+-+Justin+Hart" target="_blank">proposal</a>, but that&#8217;s far not enough.</p>
<h2>Possible Solutions</h2>
<p>For me there are two possible solutions. The first is writing Zend_Feed_Mrss and extend the <a href="http://framework.zend.com/apidoc/core/Zend_Feed/Zend_Feed_Rss.html" target="_blank">Zend_Feed_Rss</a> functionality, but that appears to be a non-trivial task. The second solution is to write custom view returning XML, which I&#8217;m choosing for now. I hope I can paste some code soon!</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/07/14/media-rss-and-zf-part-2/" rel="bookmark" title="Media RSS and ZF &#8211; Part 2">Media RSS and ZF &#8211; Part 2 </a></li>
<li><a href="/2010/04/28/zend_datesetoptions-and-format_type-in-zend-framework-1-10-3/" rel="bookmark" title="Zend_Date::setOptions and format_type in Zend Framework 1.10.3">Zend_Date::setOptions and format_type in Zend Framework 1.10.3 </a></li>
<li><a href="/2010/04/30/burn-feeds-in-zend-framework/" rel="bookmark" title="Burn Feeds in Zend Framework">Burn Feeds in Zend Framework </a></li>
<li><a href="/2010/08/23/can-twitter-replace-the-rss-feed-readers/" rel="bookmark" title="Can Twitter Replace the RSS Feed Readers">Can Twitter Replace the RSS Feed Readers </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/07/13/zend-framework-and-media-rss/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Zend Examples: GET Parameters Default Value</title>
		<link>/2010/06/16/zend-examples-get-parameters-default-value/</link>
		<comments>/2010/06/16/zend-examples-get-parameters-default-value/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 18:57:20 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[controller]]></category>
		<category><![CDATA[elegant solution]]></category>
		<category><![CDATA[Hypertext Transfer Protocol]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[Uniform Resource Identifier]]></category>
		<category><![CDATA[World Wide Web]]></category>
		<category><![CDATA[Zend Technologies]]></category>

		<guid isPermaLink="false">/?p=1619</guid>
		<description><![CDATA[PHP Style As you may know in PHP you can access everything in the request uri by accessing the global $_GET array. If there is something like that in the browser&#8217;s address field: www.example.com/index.php?controller=index&#038;action=test, you can simply get the values by that: echo $_GET['controller']; // this will print "index" echo $_GET['action']; // this will print &#8230; <a href="/2010/06/16/zend-examples-get-parameters-default-value/" class="more-link">Continue reading <span class="screen-reader-text">Zend Examples: GET Parameters Default Value</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/07/07/default-error-handling-in-zend-framework/" rel="bookmark" title="Default Error Handling in Zend Framework">Default Error Handling in Zend Framework </a></li>
<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/07/bind-zend-action-with-non-default-view/" rel="bookmark" title="Bind Zend Action with Non-Default View">Bind Zend Action with Non-Default View </a></li>
<li><a href="/2009/12/20/redirecting-with-zend-framework-part-2/" rel="bookmark" title="Redirecting with Zend Framework &#8211; part 2">Redirecting with Zend Framework &#8211; part 2 </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>PHP Style</h2>
<p>As you may know in PHP you can access everything in the request uri by accessing the global $_GET array. If there is something like that in the browser&#8217;s address field: www.example.com/index.php?controller=index&#038;action=test, you can simply get the values by that:</p>
<pre lang="php">
echo $_GET['controller']; // this will print "index"
echo $_GET['action'];     // this will print "test"
</pre>
<h2>Zend Framework, Uri &#038; Request Params</h2>
<p>If you code with Zend Framework, you should know already, and that&#8217;s perhaps the first thing you&#8217;ve learned about Zend, that $_GET params can be accessed by calling the requrest&#8217;s getParam() method. But first of all the request uri will be different. The Zend&#8217;s convetion is to place after the domain name first the module name (which is omited when there&#8217;s only one module), than the controller&#8217;s name followed by the action and the key value pairs of all parameters. In that scheme the request uri above will look like that:</p>
<pre lang="php">
http://www.example.com/index/test
</pre>
<p>Here the keywords &#8220;controller&#8221; and &#8220;action&#8221; are omitted. This is cool &#8211; it&#8217;s more user friendly and it definitely helps the SEO.</p>
<h2>Get the $_GET</h2>
<p>Once the uri is setup like so &#8211; /index/test you can access it via the Zend way:</p>
<pre lang="php">
echo $this->getRequest()->getParam('controller'); // this will print "index"
</pre>
<p>The cool thing is that in the first case you don&#8217;t have any prevention of a missing value, while in the second case there is a second parameter or the getParam() method that does this job. What if the uri is www.example.com/index.php?controller=&#038;action=test than by printing the $_GET[&#8216;controller&#8217;] you&#8217;ll get nothing. In other hand even this:</p>
<pre lang="php">
echo $this->getRequest()->getParam('action'); 
</pre>
<p>won&#8217;t return &#8220;test&#8221; if the uri is http://www.example.com/index/</p>
<p><em><strong>Note:</strong> actually here the default &#8220;index&#8221; action will be referenced!</em></p>
<p>That&#8217;s where the power of the framework comes. In the first case the solution is:</p>
<pre lang="php">
echo (empty($_GET['controller']) ? 'default': $_GET['controller']);
</pre>
<p>while in Zend there&#8217;s more elegant solution:</p>
<pre lang="php">
echo $this->getRequest()->getParam('action', 'test');
</pre>
<p>Thus when the action param is missing the &#8220;test&#8221; value is considered as default! Very useful!</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/07/07/default-error-handling-in-zend-framework/" rel="bookmark" title="Default Error Handling in Zend Framework">Default Error Handling in Zend Framework </a></li>
<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/07/bind-zend-action-with-non-default-view/" rel="bookmark" title="Bind Zend Action with Non-Default View">Bind Zend Action with Non-Default View </a></li>
<li><a href="/2009/12/20/redirecting-with-zend-framework-part-2/" rel="bookmark" title="Redirecting with Zend Framework &#8211; part 2">Redirecting with Zend Framework &#8211; part 2 </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/06/16/zend-examples-get-parameters-default-value/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Upload a File with Zend Framework</title>
		<link>/2010/04/07/upload-a-file-with-zend-framework/</link>
		<comments>/2010/04/07/upload-a-file-with-zend-framework/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 20:20:40 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[Abstraction]]></category>
		<category><![CDATA[Computer programming]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[Software engineering]]></category>
		<category><![CDATA[Software framework]]></category>
		<category><![CDATA[Zend Technologies]]></category>

		<guid isPermaLink="false">/?p=1417</guid>
		<description><![CDATA[What&#8217;s the problem of Zend Framework&#8217;s file upload approach? As I couldn&#8217;t make it work it appears it really isn&#8217;t possible to make it work. Can anyone tell me how to manage this abstraction over the PHP upload process work?<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/09/10/automatically-upload-images-with-php-directly-from-the-uri/" rel="bookmark" title="Automatically Upload Images with PHP Directly from the URI">Automatically Upload Images with PHP Directly from the URI </a></li>
<li><a href="/2010/01/25/using-zend-framework-validators-zend_validate_db_recordexists/" rel="bookmark" title="Using Zend Framework validators &#8211; Zend_Validate_Db_RecordExists">Using Zend Framework validators &#8211; Zend_Validate_Db_RecordExists </a></li>
<li><a href="/2010/07/21/setting-up-global-cache-in-zend-framework/" rel="bookmark" title="Setting Up Global Cache in Zend Framework">Setting Up Global Cache in Zend Framework </a></li>
<li><a href="/2010/05/25/download-files-with-zend-framework/" rel="bookmark" title="Download Files with Zend Framework">Download Files with Zend Framework </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>What&#8217;s the problem of Zend Framework&#8217;s file upload approach? As I couldn&#8217;t make it work it appears it really isn&#8217;t possible to make it work.</p>
<p>Can anyone tell me how to manage this abstraction over the PHP upload process work?</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/09/10/automatically-upload-images-with-php-directly-from-the-uri/" rel="bookmark" title="Automatically Upload Images with PHP Directly from the URI">Automatically Upload Images with PHP Directly from the URI </a></li>
<li><a href="/2010/01/25/using-zend-framework-validators-zend_validate_db_recordexists/" rel="bookmark" title="Using Zend Framework validators &#8211; Zend_Validate_Db_RecordExists">Using Zend Framework validators &#8211; Zend_Validate_Db_RecordExists </a></li>
<li><a href="/2010/07/21/setting-up-global-cache-in-zend-framework/" rel="bookmark" title="Setting Up Global Cache in Zend Framework">Setting Up Global Cache in Zend Framework </a></li>
<li><a href="/2010/05/25/download-files-with-zend-framework/" rel="bookmark" title="Download Files with Zend Framework">Download Files with Zend Framework </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/04/07/upload-a-file-with-zend-framework/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Read Remote File Content-Type with Zend_Http_Client</title>
		<link>/2010/03/23/read-remote-file-content-type-with-zend_http_client/</link>
		<comments>/2010/03/23/read-remote-file-content-type-with-zend_http_client/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 06:00:16 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[Computer networking]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[HEAD]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[Hypertext Transfer Protocol]]></category>
		<category><![CDATA[Internet protocols]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[remote server]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[World Wide Web]]></category>
		<category><![CDATA[Zend Technologies]]></category>

		<guid isPermaLink="false">/?p=1375</guid>
		<description><![CDATA[Check an Image on a Remote Server This is a common task. You&#8217;d like to know whether the image on the remote server exists. Zend Framework gives the answer of this question and in particular this can be completed with Zend_Http_Client. Content-Type and Content-Length The little problem is that checking for content-type is not always &#8230; <a href="/2010/03/23/read-remote-file-content-type-with-zend_http_client/" class="more-link">Continue reading <span class="screen-reader-text">Read Remote File Content-Type with Zend_Http_Client</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2011/04/07/use-fopen-to-check-file-availability/" rel="bookmark" title="Use fopen() to Check File Availability?">Use fopen() to Check File Availability? </a></li>
<li><a href="/2010/04/14/zend_http_client-and-case-sensitivity/" rel="bookmark" title="Zend_Http_Client and Case Sensitivity">Zend_Http_Client and Case Sensitivity </a></li>
<li><a href="/2011/04/13/post-with-zend_http_client/" rel="bookmark" title="POST with Zend_Http_Client">POST with Zend_Http_Client </a></li>
<li><a href="/2010/06/28/send-authenticated-post-request-with-zend_http_client/" rel="bookmark" title="Send Authenticated POST Request with Zend_Http_Client">Send Authenticated POST Request with Zend_Http_Client </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Check an Image on a Remote Server</h2>
<p>This is a common task. You&#8217;d like to know whether the image on the remote server exists. <a title="Zend Framework" href="http://framework.zend.com/" target="_blank">Zend Framework</a> gives the answer of this question and in particular this can be completed with <a href="http://framework.zend.com/manual/en/zend.http.html" target="_blank">Zend_Http_Client</a>.</p>
<h2>Content-Type and Content-Length</h2>
<p>The little problem is that checking for content-type is not always correct, because it will return an image content type even when the image does not exists, so it&#8217;s better to check for content-length.</p>
<h2>Code</h2>
<p>The simple way to check this is like that:</p>
<pre lang="php" escaped="true">$client = new Zend_Http_Client('http://remote-machine/image.jpg');
$response = $client-&gt;request('head');
if ( NULL == $response-&gt;getHeader('Content-Length') )
    // do whatever if the image does not exists.</pre>
<p>In fact here, in this example I don&#8217;t check for GET request, because is way to slow than the HEAD method, but you should be aware of incorrect responses when using HEAD. In fact if you request the HEAD of a FLV video it will be returned text content-type, while using GET everything&#8217;s working fine but slow though.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2011/04/07/use-fopen-to-check-file-availability/" rel="bookmark" title="Use fopen() to Check File Availability?">Use fopen() to Check File Availability? </a></li>
<li><a href="/2010/04/14/zend_http_client-and-case-sensitivity/" rel="bookmark" title="Zend_Http_Client and Case Sensitivity">Zend_Http_Client and Case Sensitivity </a></li>
<li><a href="/2011/04/13/post-with-zend_http_client/" rel="bookmark" title="POST with Zend_Http_Client">POST with Zend_Http_Client </a></li>
<li><a href="/2010/06/28/send-authenticated-post-request-with-zend_http_client/" rel="bookmark" title="Send Authenticated POST Request with Zend_Http_Client">Send Authenticated POST Request with Zend_Http_Client </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/03/23/read-remote-file-content-type-with-zend_http_client/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Theory of caching. Zend_Cache &#038; Zend Optimizer.</title>
		<link>/2010/01/27/theory-of-caching-zend_cache-zend-optimizer/</link>
		<comments>/2010/01/27/theory-of-caching-zend_cache-zend-optimizer/#respond</comments>
		<pubDate>Wed, 27 Jan 2010 07:08:35 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[zend framework]]></category>
		<category><![CDATA[Cache]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[Computer memory]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Cross-platform software]]></category>
		<category><![CDATA[Human Interest]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP interpreter]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[ram]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[Zend Technologies]]></category>

		<guid isPermaLink="false">/?p=930</guid>
		<description><![CDATA[Although it may sound strange I’ll say why I’m using caching. Because it speeds up the site! Yeah there’s no other reason that may be so important as this is. The caching is not a process invented in the last year, it’s useless to describe why do you need it, but however my intention is &#8230; <a href="/2010/01/27/theory-of-caching-zend_cache-zend-optimizer/" class="more-link">Continue reading <span class="screen-reader-text">Theory of caching. Zend_Cache &#038; Zend Optimizer.</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2011/01/17/a-memcached-zend_cache/" rel="bookmark" title="A Memcached Zend_Cache">A Memcached Zend_Cache </a></li>
<li><a href="/2010/07/21/setting-up-global-cache-in-zend-framework/" rel="bookmark" title="Setting Up Global Cache in Zend Framework">Setting Up Global Cache in Zend Framework </a></li>
<li><a href="/2010/11/03/how-to-overcome-zend_cache_frontend_pages-problem-with-cookies/" rel="bookmark" title="How to Overcome Zend_Cache_Frontend_Page&#8217;s Problem with Cookies">How to Overcome Zend_Cache_Frontend_Page&#8217;s Problem with Cookies </a></li>
<li><a href="/2010/07/19/zend-framework-cache-database-table-schemes/" rel="bookmark" title="Zend Framework: Cache Database Table Schemes">Zend Framework: Cache Database Table Schemes </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Although it may sound strange I’ll say why I’m using caching. Because it speeds up the site! Yeah there’s no other reason that may be so important as this is.</p>
<p>The caching is not a process invented in the last year, it’s useless to describe why do you need it, but however my intention is to describe how to make it work with Zend Framework.</p>
<p>The docs page of <a title="Zend_Cache docs" href="http://framework.zend.com/manual/en/zend.cache.introduction.html" target="_blank">Zend_Cache</a> is pretty clear about everything and I’ll describe the most important part of the cache setup.</p>
<p>First setup the cache back and frontend options. You need to decide where to save the cache files, how to cache them, and what lifetime do they need.</p>
<p>The most used cache configuration is, as you may guess, this one described into the doc page. Setup the front and backend options is just as simple as:</p>
<blockquote>
<pre>$frontendOptions = array(
     'lifetime' =&gt; 7200, // cache lifetime of 2 hours
     'automatic_serialization' =&gt; true
);

$backendOptions = array(
   'cache_dir' =&gt; './tmp/'
   // Directory where to put the cache files
);

// getting a Zend_Cache_Core object
$cache = Zend_Cache::factory('Core',
                             'File',
                              $frontendOptions,
                              $backendOptions);</pre>
</blockquote>
<p>Because all this is well described into the doc page, which you can found <a title="Zend_Cache docs" href="http://framework.zend.com/manual/en/zend.cache.introduction.html" target="_blank">here</a> I won&#8217;t talk about it. But I’ll talk only about one sole thing. How much the cache must live? What should be its lifetime.</p>
<p>The answer is simple. If you have some basic statistic of your site traffic and you don’t change much the data you can prefer longer cache period. But imagine the site’s making 1000 visits per minute! Than even if you cache every minute and the cache expires every minute will be a success and the user perception will be really great. From those 1000 visitors only few will wait until the cache’s built and the other hundreds will receive really fast response!</p>
<p>Be careful when you cache only because you can overflow the directory where you cache, which will be difficult though.</p>
<p>In other way many people are thinking about <a title="Zend Optimizer" href="http://www.zend.com/en/products/guard/zend-optimizer" target="_blank">Zend Optimizer</a> and its work with Zend_Cache. These are really different things. Zend Optimizer has nothing to do with your code it is a PHP caching tool. As you may know PHP interpreter mingles the code into “machine like” code, which in turn can be cached into the RAM with the help of Zend Optimizer. Checkout more here.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2011/01/17/a-memcached-zend_cache/" rel="bookmark" title="A Memcached Zend_Cache">A Memcached Zend_Cache </a></li>
<li><a href="/2010/07/21/setting-up-global-cache-in-zend-framework/" rel="bookmark" title="Setting Up Global Cache in Zend Framework">Setting Up Global Cache in Zend Framework </a></li>
<li><a href="/2010/11/03/how-to-overcome-zend_cache_frontend_pages-problem-with-cookies/" rel="bookmark" title="How to Overcome Zend_Cache_Frontend_Page&#8217;s Problem with Cookies">How to Overcome Zend_Cache_Frontend_Page&#8217;s Problem with Cookies </a></li>
<li><a href="/2010/07/19/zend-framework-cache-database-table-schemes/" rel="bookmark" title="Zend Framework: Cache Database Table Schemes">Zend Framework: Cache Database Table Schemes </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/01/27/theory-of-caching-zend_cache-zend-optimizer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
