<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2.1" -->
<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/"
	>

<channel>
	<title>Web Article Technologies Expert</title>
	<link>http://www.wertex.org</link>
	<description>Articles, SEO, Web Development Blog of Kanquona</description>
	<pubDate>Mon, 01 Jun 2009 16:18:45 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>
	<language>en</language>
			<item>
		<title>Object Relationship Mapping, Framework and PHP</title>
		<link>http://www.wertex.org/2009/06/01/object-relationship-mapping-framework-and-php/</link>
		<comments>http://www.wertex.org/2009/06/01/object-relationship-mapping-framework-and-php/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 16:18:15 +0000</pubDate>
		<dc:creator>Anirban Bhattacharya</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.wertex.org/2009/06/01/object-relationship-mapping-framework-and-php/</guid>
		<description><![CDATA[If you are a PHP developer and use PHP for high end application development, you definitely felt the need of a good ORM like Java used to have Hibernate. Object Relationship Mapping is indeed needed for an application at the level of enterprise solution. in PHP though some of the fraemworks support ORM, some not.
If [...]]]></description>
			<content:encoded><![CDATA[<p>If you are a PHP developer and use PHP for high end application development, you definitely felt the need of a good ORM like Java used to have Hibernate. Object Relationship Mapping is indeed needed for an application at the level of enterprise solution. in PHP though some of the fraemworks support ORM, some not.</p>
<p>If you happen to be using any framework which, does not support ORM, do not get disheartened. There are atleast two projects running which can fulfill your needs at least partly or even fully.</p>
<p><strong><a href="http://propel.phpdb.org/trac/" title="Propel">Propel</a></strong> is one such venture. Another similar project is <strong><a href="http://coughphp.com/" title="CoughPHP">CoughPHP</a></strong>. You can try either of the two and definitely, it will help.</p>
<p>Happy Coding!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wertex.org/2009/06/01/object-relationship-mapping-framework-and-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Zend Framework - Resources</title>
		<link>http://www.wertex.org/2009/02/15/zend-framework-resources/</link>
		<comments>http://www.wertex.org/2009/02/15/zend-framework-resources/#comments</comments>
		<pubDate>Sun, 15 Feb 2009 13:26:17 +0000</pubDate>
		<dc:creator>Anirban Bhattacharya</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.wertex.org/2009/02/15/zend-framework-resources/</guid>
		<description><![CDATA[Those who are seriously considering to learn Zend Framework and looking for some resources to start with, I have a few links to share with them. But before you start learning any framework, you need to brush up your language and technical skills. Please, do remember, your framework might not guide and guard you from [...]]]></description>
			<content:encoded><![CDATA[<p>Those who are seriously considering to learn Zend Framework and looking for some resources to start with, I have a few links to share with them. But before you start learning any framework, you need to brush up your language and technical skills. Please, do remember, your framework might not guide and guard you from all practical challenges. You might need to add additional codes or extend the code base.</p>
<p><strong>The approach:</strong> You should have Zend Framework latest version downloaded. There are two good books, I can recommend you to purchase, with which you can start your basic building blocks.</p>
<p>1. <strong><a href="http://www.survivethedeepend.com/" title="Surviving the deep end- Zend framework book">Surviving the deep end</a></strong> is an online book where the approach of the author is excellent. If you read the few chapters available there, you will gain some idea about the framework, the MVC model and a mind to start with.</p>
<p>2. <strong><a href="http://www.zendframeworkinaction.com/" title="Zend Framework in action">Zend Framework in action</a></strong>  is another book, on which you can depend a lot for the initial phases of coding. PHP|Architect&#8217;s Zend framework is also another book, which has some vaulable insights.</p>
<p>Once you have the initial concepts, have some idea about the basic APIs and usage of controllers like ZendDb, ZendAuth, ZendForm, ZendAcl, ZendView etc, the next approach will be to consult reference manual, API resources and online articles.</p>
<p>I know that point onwards you need no guidance, but for the initial start, the resources I provided are really good enough.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wertex.org/2009/02/15/zend-framework-resources/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Working with MySQL View - Datatype Problem</title>
		<link>http://www.wertex.org/2009/02/02/working-with-mysql-view-datatype-problem/</link>
		<comments>http://www.wertex.org/2009/02/02/working-with-mysql-view-datatype-problem/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 16:29:31 +0000</pubDate>
		<dc:creator>Anirban Bhattacharya</dc:creator>
		
		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.wertex.org/2009/02/02/working-with-mysql-view-datatype-problem/</guid>
		<description><![CDATA[Of late, I was working with a problem where I had to prepare a report in grid format with pagination facility. Above all every page of the report will have a summary section. The summary section will display summary of some of the columns like unique count, maximum, average, minimum value etc. This require using [...]]]></description>
			<content:encoded><![CDATA[<p>Of late, I was working with a problem where I had to prepare a report in grid format with pagination facility. Above all every page of the report will have a summary section. The summary section will display summary of some of the columns like unique count, maximum, average, minimum value etc. This require using the main query as a subset of another query to extract the summary result. Again the main query had join of ten tables. This became a great challenge for optimization. As we cannot allow more than 15-20 seconds for page load, which suggests the query should execute in less than 1 second.</p>
<p>I opted for View with MERGE option so that the view keeps the indexes of the table involved. Once the view created I faced a strange problem. All the numeric and date datatype fields were converted into varbinary datatype in the view. And that become very difficult  while I was sorting the result.</p>
<p>Ultimately I found a way out. Using Cast option in select statement. Somehow like this.</p>

<div class="wp_syntax"><div class="code"><pre class="mysql mysql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> ALG<span style="color: #66cc66;">OR</span>ITHM<span style="color: #66cc66;">=</span>MERGE VIEW view_name as
<span style="color: #993333; font-weight: bold;">SELECT</span> CAST<span style="color: #66cc66;">&#40;</span>age as <span style="color: #aa9933; font-weight: bold;">DECIMAL</span><span style="color: #66cc66;">&#41;</span> as age, CAST<span style="color: #66cc66;">&#40;</span>DOB as <span style="color: #aa9933; font-weight: bold;">DATE</span><span style="color: #66cc66;">&#41;</span> as DOB
<span style="color: #993333; font-weight: bold;">FROM</span> table1
<span style="color: #993333; font-weight: bold;">LEFT</span> <span style="color: #993333; font-weight: bold;">JOIN</span>...
....................................................</pre></div></div>

<p>And it solved the problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wertex.org/2009/02/02/working-with-mysql-view-datatype-problem/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Encapsulation: Keeping variables private</title>
		<link>http://www.wertex.org/2009/01/17/encapsulation-keeping-variables-private/</link>
		<comments>http://www.wertex.org/2009/01/17/encapsulation-keeping-variables-private/#comments</comments>
		<pubDate>Sat, 17 Jan 2009 19:02:17 +0000</pubDate>
		<dc:creator>Anirban Bhattacharya</dc:creator>
		
		<category><![CDATA[Web Development]]></category>

		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.wertex.org/2009/01/17/encapsulation-keeping-variables-private/</guid>
		<description><![CDATA[In the world of objects, encapsulation is a popular term. But sometimes we never pay enough attention to properly declare the access type of instance variables. Yes, I mean to say in terms of design and class architecture perspective. The basic advantage of object oriented programming is code re-usability. Meaning, using your class in a [...]]]></description>
			<content:encoded><![CDATA[<p>In the world of objects, encapsulation is a popular term. But sometimes we never pay enough attention to properly declare the access type of instance variables. Yes, I mean to say in terms of design and class architecture perspective. The basic advantage of object oriented programming is code re-usability. Meaning, using your class in a different program or changing your class shall not affect any other parts of code, which uses it. Now, if most of your instance variables are public and if (say) several other classes extends your class, or use its objects, then if any day you want to change the behavior of that instance variables, then all those codes will require re-work. Like say, if you want to ensure that the instance variables should have a value range and it will not accept any value outside that range.</p>
<p>Consider a class automobile with an instance variable no_of_wheels. Will you allow any other code to assign a value of fraction or a negative value to the member variables? It is better to declare the variable as private and use getter and setter method to control the assignment behavior. Only in this way you can achieve the truest meaning of encapsulation. Here is the pseudo code example.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
</pre></td><td class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">Class</span> Automobile <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> int no_of_wheels;
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> setWheels<span style="color: #009900;">&#40;</span>int wheel_num<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
      this<span style="color: #339933;">.</span>no_of_wheels <span style="color: #339933;">=</span> wheel_num; <span style="color: #666666; font-style: italic;">//setting value to the class variables.</span>
&nbsp;
      <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>this<span style="color: #339933;">.</span>no_of_wheels <span style="color: #339933;">&amp;</span>lt; <span style="color:#800080;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
         this<span style="color: #339933;">.</span>no_of_wheels <span style="color: #339933;">=</span> <span style="color:#800080;">0</span> <span style="color: #339933;">-</span> this<span style="color: #339933;">.</span>no_of_wheels;
&nbsp;
      <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">public</span> getWheels<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
     <span style="color: #b1b100;">return</span> this<span style="color: #339933;">.</span>no_of_wheels;
&nbsp;
  <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>I know, the question in your mind is then shall I not declare any member variable as public. Sure, you can  but ensure that it can have any range of values. If the type is boolean then safely, it can be a candidate of public access type. But I prefer keeping things private.</p>
<p>Please let me know if I am wrong.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wertex.org/2009/01/17/encapsulation-keeping-variables-private/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Tribute to Airtel</title>
		<link>http://www.wertex.org/2009/01/13/tribute-to-airtel/</link>
		<comments>http://www.wertex.org/2009/01/13/tribute-to-airtel/#comments</comments>
		<pubDate>Tue, 13 Jan 2009 19:07:39 +0000</pubDate>
		<dc:creator>Anirban Bhattacharya</dc:creator>
		
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.wertex.org/2009/01/13/tribute-to-airtel/</guid>
		<description><![CDATA[I could not write for the past two months. I could not write because I didn&#8217;t have internet connection. Yes, it is a hard fact. In 2009, in one of the metropolitan cities, I struggled to get an internet connection. Why? The story is long, but in one liner, like most of the places in [...]]]></description>
			<content:encoded><![CDATA[<p>I could not write for the past two months. I could not write because I didn&#8217;t have internet connection. Yes, it is a hard fact. In 2009, in one of the metropolitan cities, I struggled to get an internet connection. Why? The story is long, but in one liner, like most of the places in India, my current residential place too, didn&#8217;t have last mile network. I ran from pillar to post, went to all service providers, yet could not avail of a connection.</p>
<p>Finally, the ray of hope sparked and soon extinguished. I had no way this time, but to be offensive. That paid. However all credit goes to Airtel. In my opinion the finest service provider in India. Understanding my plight, they rapidly arranged connection in just two days. From the time I complained to their support, till I got the connection, they continuously updated me on the status and found thousand solutions to every problem they came accross.</p>
<p>I salute Airtel and request everybody to try their service. It&#8217;s simply excellent.</p>
<p>Thank you <strong>Airtel</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wertex.org/2009/01/13/tribute-to-airtel/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Recursively Copying Directory</title>
		<link>http://www.wertex.org/2008/10/12/recursively-copying-directory/</link>
		<comments>http://www.wertex.org/2008/10/12/recursively-copying-directory/#comments</comments>
		<pubDate>Sun, 12 Oct 2008 16:32:16 +0000</pubDate>
		<dc:creator>Anirban Bhattacharya</dc:creator>
		
		<category><![CDATA[Web Development]]></category>

		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.wertex.org/2008/10/12/recursively-copying-directory/</guid>
		<description><![CDATA[A small code snippet, which is very common yet useful. Let&#8217;s write a function which will copy a folder/directory and its contents (including subfolders, files) from one place to other.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
public static function copyFolder&#40;$source,$dest&#41; &#123; // recursive function
   if&#40;is_dir&#40; $source&#41;&#41; &#123; // if its directory
          [...]]]></description>
			<content:encoded><![CDATA[<p>A small code snippet, which is very common yet useful. Let&#8217;s write a function which will copy a folder/directory and its contents (including subfolders, files) from one place to other.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #990000;">static</span> <span style="color: #000000; font-weight: bold;">function</span> copyFolder<span style="color: #009900;">&#40;</span><span style="color: #000088;">$source</span><span style="color: #339933;">,</span><span style="color: #000088;">$dest</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// recursive function</span>
   <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">is_dir</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$source</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// if its directory</span>
           <span style="color: #339933;">@</span><span style="color: #990000;">mkdir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dest</span><span style="color: #009900;">&#41;</span>; <span style="color: #666666; font-style: italic;">//make it</span>
           <span style="color: #000088;">$d</span> <span style="color: #339933;">=</span> <span style="color: #990000;">dir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$source</span><span style="color: #009900;">&#41;</span>; <span style="color: #666666; font-style: italic;">// create directory object</span>
           <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">FALSE</span><span style="color: #339933;">!==</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$entry</span><span style="color: #339933;">=</span><span style="color: #000088;">$d</span><span style="color: #339933;">-&amp;</span>gt;read<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// read each file of directory</span>
               <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$entry</span><span style="color: #339933;">==</span><span style="">'.'</span> || <span style="color: #000088;">$entry</span> <span style="color: #339933;">==</span> <span style="">'..'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">//exclude root and parent</span>
                  <span style="color: #b1b100;">continue</span>;
               <span style="color: #009900;">&#125;</span>
              <span style="color: #000088;">$newentry</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$source</span> <span style="color: #339933;">.</span> <span style="">'/'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$entry</span>;  <span style="color: #666666; font-style: italic;">// get sub</span>
              <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">is_dir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$newentry</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// if sub is directory</span>
                  <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #004000;">copyFolder</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$newentry</span><span style="color: #339933;">,</span><span style="color: #000088;">$dest</span><span style="color: #339933;">.</span><span style="">'/'</span><span style="color: #339933;">.</span><span style="color: #000088;">$entry</span><span style="color: #009900;">&#41;</span>; <span style="color: #666666; font-style: italic;">// then go recursive</span>
                  <span style="color: #b1b100;">continue</span>;
              <span style="color: #009900;">&#125;</span>
              <span style="color: #990000;">copy</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$newentry</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dest</span><span style="color: #339933;">.</span><span style="">'/'</span><span style="color: #339933;">.</span><span style="color: #000088;">$entry</span> <span style="color: #009900;">&#41;</span>; <span style="color: #666666; font-style: italic;">//else copy file</span>
           <span style="color: #009900;">&#125;</span>
           <span style="color: #000088;">$d</span><span style="color: #339933;">-&amp;</span>gt;close<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #990000;">copy</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$source</span><span style="color: #339933;">,</span><span style="color: #000088;">$dest</span><span style="color: #009900;">&#41;</span>; <span style="color: #666666; font-style: italic;">// copy file</span>
        <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>I hope this code will be a helpful contribution. Please do let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wertex.org/2008/10/12/recursively-copying-directory/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Understanding MVC architecture through Zend Framework</title>
		<link>http://www.wertex.org/2008/08/15/understanding-mvc-architecture-through-zend-framework/</link>
		<comments>http://www.wertex.org/2008/08/15/understanding-mvc-architecture-through-zend-framework/#comments</comments>
		<pubDate>Fri, 15 Aug 2008 15:57:42 +0000</pubDate>
		<dc:creator>Anirban Bhattacharya</dc:creator>
		
		<category><![CDATA[Apache]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.wertex.org/2008/08/15/understanding-mvc-architecture-through-zend-framework/</guid>
		<description><![CDATA[These days there are lot of buzz about using framework in the PHP developer community. Framework or the tool towards rapid web application development. Framework was not a new thing to Java world or even Ruby. But in PHP it is a vogue concept. This is primarily for the reason that in PHP a single [...]]]></description>
			<content:encoded><![CDATA[<p>These days there are lot of buzz about using framework in the PHP developer community. Framework or the tool towards rapid web application development. Framework was not a new thing to Java world or even Ruby. But in PHP it is a vogue concept. This is primarily for the reason that in PHP a single task can be accomplished in multiple ways and developers were used to prefer their own way of doing the task. So lack of common consensus was leading to thousands and thousands way of achieving targets. There were class repositories, there were code libraries but not any framework. Zend started a pioneering work in this regard and then came cakePHP in the line of ruby on rail. Today there are plenty of frameworks available, but unfortunately so far none of them are de-facto standard.</p>
<p><strong>What is a framework?</strong></p>
<p>Say, you are going to build a web application. Regarding the web applications there are three aspects of development. One is the code which will interact with the database. That is will store and retrieve data. Then there can be code to send mail, to send or receive XML requests from other server. The next set of code build the business logic, that is builds the right query to get the data suitable for the context. The third set is the display part, that is the UI which is presented before the user. So typically a web application works in this manner.</p>
<p><code><strong>User Requests Page &#8212;&gt; The Page builds the logic &#8212;&gt; interacts with the code base to get the data &#8212;&gt; formats the data with color, border etc and displays.</strong></code></p>
<p>Now, if you are building one web application it is ok for you to build it any way you like. But if building applications are your breads and butter then writing the same code base again and again for different applications is a los making proposition. What if, we can separate out various layers of the application and can reuse some of the layers. If we can structure the layers and can freeze it and over that structure we can build thousands of applications by altering the business logic and User Interface.</p>
<p><a href="http://www.wertex.org/wp-content/uploads/2008/08/three-layer.jpg" title="Three Layers of web applications"><img src="http://www.wertex.org/wp-content/uploads/2008/08/three-layer.jpg" alt="Three Layers of web applications" width="423" border="0" height="262" /></a></p>
<p><strong>The MVC architecture:</strong></p>
<p>The Model-View-Controller architecture uses the same three tier model. Here the business layer is the controller. The requests first comes to the controller and the controller interacts with model and view layer to prepare data.</p>
<p><strong>Using MVC with zend framework:</strong></p>
<p>To understand the usage we first need to understand the zend framework and MVC and then we need to know how we can use these two. Zend framework comes with a folder named Zend which you will get after unpacking the downloads.  This folder has some built in controllers which we can extend to build our controller logic. A controller can have several components. Like a login controller can have three components which are nothing but the action point of controllers. These components are login page, login processing and logout action. So in zend controllers and componets are separated out using &#8216;/&#8217; . That is if a page request is abc.com/aa/bb then aa is the controller and bb is the component of the controller.</p>
<p><a href="http://www.wertex.org/wp-content/uploads/2008/08/mvc.jpg" title="Zend framework and MVC architecture"><img src="http://www.wertex.org/wp-content/uploads/2008/08/mvc.jpg" alt="Zend framework and MVC architecture" width="419" border="0" height="373" /></a></p>
<p><strong>Installation:</strong> The installation of zend framework is easy and the common practice is putting the zend folder under a folder library. In this article we will discuss how we can keep all codes into the web folder so that we can use it in shared hosting too. But the ideal installation is keeping the fraework codes at the top of web folder.After installation you folder structure can be like this</p>
<p><code>/webfolder (document root)<br />
/webfolder/library/zend<br />
/webfolder/controllers<br />
/webfolder/models<br />
/webfolder/views<br />
/webfolder/views/helpers</code></p>
<p>Now views/helpers folder will have all your javascript and css file and controllers folder will have all your controller script.</p>
<p>Create an .htaccess file in the webfolder and its content will be.</p>

<div class="wp_syntax"><div class="code"><pre class="apache apache" style="font-family:monospace;"><span style="color: #00007f;">RewriteCond</span> %{REQUEST_FILENAME} !-f
<span style="color: #00007f;">RewriteCond</span> %{REQUEST_FILENAME} !-d
<span style="color: #00007f;">RewriteCond</span> %{REQUEST_FILENAME} !-l
<span style="color: #00007f;">RewriteRule</span> .* index.php [L]</pre></div></div>

<p>This will ensure that all requests to the website arrives at index.php and is channelized through it.</p>
<p>Now create a file index.php in the web folder and put these lines there.</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//We will load zend loader</span>
<span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">&quot;Zend/Loader.php&quot;</span>;
Zend_Loader<span style="color: #339933;">::</span><span style="color: #004000;">registerAutoload</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #666666; font-style: italic;">//Create the front controller</span>
<span style="color: #000088;">$frontController</span> <span style="color: #339933;">=</span> Zend_Controller_Front<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #666666; font-style: italic;">//error handling = true</span>
<span style="color: #000088;">$frontController</span><span style="color: #339933;">-&amp;</span>gt;throwExceptions<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>;
<span style="color: #666666; font-style: italic;">// set controllers directory</span>
<span style="color: #000088;">$frontController</span><span style="color: #339933;">-&amp;</span>gt;setControllerDirectory<span style="color: #009900;">&#40;</span><span style="">'controllers'</span><span style="color: #009900;">&#41;</span>;
<span style="color: #666666; font-style: italic;">//send request to controller</span>
<span style="color: #000088;">$frontController</span><span style="color: #339933;">-&amp;</span>gt;dispatch<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</pre></div></div>

<p>So when the page request is abc.com/xxx/yy the zend front controller will pas the request to a file xxxController.php in the controllers folder. This suggest you should create a file xxxController.php in the controllers folder.</p>
<p>In that page your code will be</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> xxxController <span style="color: #000000; font-weight: bold;">extends</span> Zend_Controller_Action <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> indexAction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>     <span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">//this method will be called when the request is abc.com/xxx or there are no components. in that case default index component is called.</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> yyAction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">//our case, that is abc.com/xxx/yy . Here the xxx controller is passing the request to yy componet</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><strong>Your views folder: </strong>Now the tricky thing. How the views will be controlled. For this in the views folder create a folder scripts and then create folder as per the controller name. So your views folder will have a scripts folder under it and then a xxx folder in the scripts folder. Each controllers folder will have an index.phtml file there and in this file your html will stay.</p>
<p>Now when you call abc.com/xxx/yy the request will pass to xxxControllers.php and then it will render the index.phtml under views/scripts/xxx folder.</p>
<p>This is simply an overview and then hundreds  of questions still remained. like how can I use javascript? How can I controll views? What is the role of models folder? etc.</p>
<p>The space is so little to discuss all. But I will continue it as a series as I myself learn the entire art. I will be learning the framework and so you, with me.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wertex.org/2008/08/15/understanding-mvc-architecture-through-zend-framework/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Yahoo Boss Search And Web Explore</title>
		<link>http://www.wertex.org/2008/08/07/yahoo-boss-search-and-web-explore/</link>
		<comments>http://www.wertex.org/2008/08/07/yahoo-boss-search-and-web-explore/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 15:34:05 +0000</pubDate>
		<dc:creator>Anirban Bhattacharya</dc:creator>
		
		<category><![CDATA[Web Development]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.wertex.org/2008/08/07/yahoo-boss-search-and-web-explore/</guid>
		<description><![CDATA[As a open source programmer, I have used several classes or codes widely available over the internet. I was thinking to contribute some of my knowledge as well. So, I decided to contribute on regular basis classes to phpclasses repository. Here are two of my contributions.
WEB EXPLORE 1.0
This package is about displaying folders and files [...]]]></description>
			<content:encoded><![CDATA[<p>As a open source programmer, I have used several classes or codes widely available over the internet. I was thinking to contribute some of my knowledge as well. So, I decided to contribute on regular basis classes to phpclasses repository. Here are two of my contributions.</p>
<h3>WEB EXPLORE 1.0</h3>
<p>This package is about displaying folders and files in windows explorer style. Basically, I was learning observer-observable design pattern and somehow extended the pattern to produce this application. Since I am a very good designer, the package interface is horrible to get. Basically, you need a lot of work to get it a decent look. Regarding the class, I tried my best to keep it flexible enough for modification. You can do anything with the code as it is completely free.</p>
<p><a href="http://anirban76b.users.phpclasses.org/browse/package/4676.html" title="WebExplore 1.0 - A class for viewing files and folders in explorer style"><strong>GET THE WEBEXPLORE 1.0 HERE.</strong></a></p>
<h3>YAHOO BOSS SEARCH</h3>
<p>This package uses Yahoo Boss Search API to display web and image search result. In this package too, you will experience my design skill. It&#8217;s not poor, it&#8217;s not worst, it&#8217;s simply terrible. I hope you won&#8217;t mind that and will change the design while using the class. I also tried to put an ajax example using jquery.</p>
<p><a href="http://anirban76b.users.phpclasses.org/browse/package/4723.html" title="Yahoo Boss Search - Search web with the help of Yahoo"><strong>GET YAHOO BOSS SEARCH 1.0.1 HERE </strong></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.wertex.org/2008/08/07/yahoo-boss-search-and-web-explore/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Alternative PHP Cache - A fine progress meter upload example</title>
		<link>http://www.wertex.org/2008/07/20/alternative-php-cache-a-fine-progress-meter-upload-example/</link>
		<comments>http://www.wertex.org/2008/07/20/alternative-php-cache-a-fine-progress-meter-upload-example/#comments</comments>
		<pubDate>Sun, 20 Jul 2008 15:43:01 +0000</pubDate>
		<dc:creator>Anirban Bhattacharya</dc:creator>
		
		<category><![CDATA[Web Development]]></category>

		<category><![CDATA[Apache]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.wertex.org/2008/07/20/alternative-php-cache-a-fine-progress-meter-upload-example/</guid>
		<description><![CDATA[Alternative PHP Cache is a PECL extension, which can be utilized for many purposes. The best thing is that it can check if a file has been modified on every request. Rasmus Lerdorf (you should know the name if you are a PHP guy) who was also a pioneer in the extension development, came up [...]]]></description>
			<content:encoded><![CDATA[<p>Alternative PHP Cache is a <a href="http://pecl.php.net/package/APC" title="Alternative PHP Cache">PECL</a> extension, which can be utilized for many purposes. The best thing is that it can check if a file has been modified on every request. <a href="http://lerdorf.com/" title="Rasmus Lardorf - Father of PHP">Rasmus Lerdorf</a> (you should know the name if you are a PHP guy) who was also a pioneer in the extension development, came up with a classic example.</p>
<p>The example is available in <a href="http://progphp.com/progress.php" title="PHP file upload progress bar example">http://progphp.com/progress.php</a> and you can view the source code <a href="http://progphp.com/progress.phps" title="PHP based file upload progress meter">here</a>. This code example uses <a href="http://developer.yahoo.com/yui/" title="Yahoo User Interface">YUI</a> code library for presentation layer and JSON for data transfer. apc_fetch function is being used to get the status from the cache. To use it fully all you need to do is to install PECL and this extension in your system. The rest is pure magic.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wertex.org/2008/07/20/alternative-php-cache-a-fine-progress-meter-upload-example/feed/</wfw:commentRss>
		</item>
		<item>
		<title>SIMILE - Timeline Project</title>
		<link>http://www.wertex.org/2008/05/07/simile-timeline-project/</link>
		<comments>http://www.wertex.org/2008/05/07/simile-timeline-project/#comments</comments>
		<pubDate>Wed, 07 May 2008 16:43:11 +0000</pubDate>
		<dc:creator>Anirban Bhattacharya</dc:creator>
		
		<category><![CDATA[Web Development]]></category>

		<category><![CDATA[Online tools]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.wertex.org/2008/05/07/simile-timeline-project/</guid>
		<description><![CDATA[I came across the timeline project of SIMILE and found that it is simply wonderful. This project creates a band of time and date of events. I found that this project can be used to create historical time period mapping with important dates and events. Creating GANTT chart for  project management software will be [...]]]></description>
			<content:encoded><![CDATA[<p>I came across the <a href="http://simile.mit.edu/timeline/" title="Timeline Project - Simile">timeline</a> project of <a href="http://simile.mit.edu/" title="SIMILE">SIMILE</a> and found that it is simply wonderful. This project creates a band of time and date of events. I found that this project can be used to create historical time period mapping with important dates and events. Creating GANTT chart for  project management software will be a cakewalk  if the code base is used. Practically  this  project  can be used in several areas.  I am going to explore  it. What  about you?</p>
<p><a href="http://www.wertex.org/wp-content/uploads/2008/05/timeline.JPG" title="Timeline - Simile"><img src="http://www.wertex.org/wp-content/uploads/2008/05/timeline.JPG" alt="Timeline - Simile" height="251" width="415" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.wertex.org/2008/05/07/simile-timeline-project/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
