<?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>Uniform Resource Identifier &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/uniform-resource-identifier/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>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>Prevent link default action when mousedown and mouseup fires!</title>
		<link>/2010/01/26/prevent-link-default-action-when-mousedown-and-mouseup-fires/</link>
		<comments>/2010/01/26/prevent-link-default-action-when-mousedown-and-mouseup-fires/#respond</comments>
		<pubDate>Tue, 26 Jan 2010 06:17:37 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[DOM events]]></category>
		<category><![CDATA[HTML element]]></category>
		<category><![CDATA[Human Interest]]></category>
		<category><![CDATA[Uniform Resource Identifier]]></category>
		<category><![CDATA[URI scheme]]></category>

		<guid isPermaLink="false">/?p=924</guid>
		<description><![CDATA[What is preventing default? I’m sure you know how to prevent the default action of a link when onclick event is attached to it. Yes, it is a common task and by simply adding a return false; at the end of the method called on click it simply doesn’t call the refresh the page. This &#8230; <a href="/2010/01/26/prevent-link-default-action-when-mousedown-and-mouseup-fires/" class="more-link">Continue reading <span class="screen-reader-text">Prevent link default action when mousedown and mouseup fires!</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<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="/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/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>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>What is preventing default?</h2>
<p>I’m sure you know how to prevent the default action of a link when onclick event is attached to it. Yes, it is a common task and by simply adding a return false; at the end of the method called on click it simply doesn’t call the refresh the page. This is really an everyday task. To describe it first, let’s imagine there’s a link with # href value:</p>
<blockquote>
<pre>&lt;a onclick="”myFunc()”" href="”#”"&gt;click here&lt;/a&gt;</pre>
</blockquote>
<p>Than the definition of myFunc() is something like that:</p>
<blockquote>
<pre>function myFunc() {
   ...
   return false;
}</pre>
</blockquote>
<p>If that “return false” part was missing you simply get additional # in the uri of the page and worse &#8211; you may be scrolled to the top of the page, because of the lack of an anchor with empty name.</p>
<p>OK, but we know how to deal it! But what happens when you don’t attach click event but mousedown/mouseup pair? It may seem the same thing but it is not!</p>
<p>When you place return false on both event handlers of the mousedown/up events nothing happens, there is a # on the end of the uri and yes the document is scrolled.</p>
<h2>How the prevent the default action?</h2>
<p>Simply by adding onclick event! We already know that this is working and prevents the default action. Just do the following:</p>
<blockquote>
<pre>$(‘#element_id’).mousedown(function(){
    ...
    return false;
});
$(#element_id’).mouseup(function() {
   ...
   return false;
});

// this doesn’t work like preventing the default refresh
// action until ....
$(‘#element_id’).click(function() {
   return false;
});
// is added</pre>
</blockquote>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<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="/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/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>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/01/26/prevent-link-default-action-when-mousedown-and-mouseup-fires/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
