<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
	>
<channel>
	<title>Comments on: Write your own PHP MVC Framework (Part 2)</title>
	<atom:link href="http://anantgarg.com/2009/03/30/write-your-own-php-mvc-framework-part-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://anantgarg.com/2009/03/30/write-your-own-php-mvc-framework-part-2/</link>
	<description>on web development</description>
	<pubDate>Thu, 29 Jul 2010 19:19:23 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: krnel</title>
		<link>http://anantgarg.com/2009/03/30/write-your-own-php-mvc-framework-part-2/comment-page-2/#comment-6430</link>
		<dc:creator>krnel</dc:creator>
		<pubDate>Sun, 11 Jul 2010 03:00:27 +0000</pubDate>
		<guid isPermaLink="false">http://anantgarg.com/?p=200#comment-6430</guid>
		<description>Sorry, but another Q:

in shared.php
with the url containing:  categories/view/1/Electronics
the queryString has 2 values, '1', 'Electronics'

later in shared.php
call_user_func_array(array($dispatch,$action),$queryString);
it calls as CategoriesController-&gt;view($queryString)

in categoriescontroller.php
the parameters queryString is received as categoryId.
when checking the value of categoryId it is not the same as queryString, there is only the value '1' remaining.  'Electronics' is no longer there.

How is it that passing in an array with two values, is received not as an array, but as one single value?

I do not understand how this is happening.

Thanks again :)</description>
		<content:encoded><![CDATA[<p>Sorry, but another Q:</p>
<p>in shared.php<br />
with the url containing:  categories/view/1/Electronics<br />
the queryString has 2 values, &#8216;1&#8242;, &#8216;Electronics&#8217;</p>
<p>later in shared.php<br />
call_user_func_array(array($dispatch,$action),$queryString);<br />
it calls as CategoriesController-&gt;view($queryString)</p>
<p>in categoriescontroller.php<br />
the parameters queryString is received as categoryId.<br />
when checking the value of categoryId it is not the same as queryString, there is only the value &#8216;1&#8242; remaining.  &#8216;Electronics&#8217; is no longer there.</p>
<p>How is it that passing in an array with two values, is received not as an array, but as one single value?</p>
<p>I do not understand how this is happening.</p>
<p>Thanks again <img src='http://anantgarg.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: krnel</title>
		<link>http://anantgarg.com/2009/03/30/write-your-own-php-mvc-framework-part-2/comment-page-2/#comment-6428</link>
		<dc:creator>krnel</dc:creator>
		<pubDate>Sun, 11 Jul 2010 01:33:20 +0000</pubDate>
		<guid isPermaLink="false">http://anantgarg.com/?p=200#comment-6428</guid>
		<description>Thank you for the great tut.  Can you explain why this condition is here?

sqlquery.class.php
line 87
$conditions = '\'1\'=\'1\' AND ';

Doesn't seem to make sense to make a condition where 1=1...

Thanks.</description>
		<content:encoded><![CDATA[<p>Thank you for the great tut.  Can you explain why this condition is here?</p>
<p>sqlquery.class.php<br />
line 87<br />
$conditions = &#8216;\&#8217;1\&#8217;=\&#8217;1\&#8217; AND &#8216;;</p>
<p>Doesn&#8217;t seem to make sense to make a condition where 1=1&#8230;</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: muxcmux</title>
		<link>http://anantgarg.com/2009/03/30/write-your-own-php-mvc-framework-part-2/comment-page-2/#comment-6411</link>
		<dc:creator>muxcmux</dc:creator>
		<pubDate>Fri, 09 Jul 2010 11:43:31 +0000</pubDate>
		<guid isPermaLink="false">http://anantgarg.com/?p=200#comment-6411</guid>
		<description>Both parts of your tutorial are very inspirational! Very CakePHP-ish by the way "hasManyAndBelongsToMany" :))) Can't wait for part 3. Keep it up!!!</description>
		<content:encoded><![CDATA[<p>Both parts of your tutorial are very inspirational! Very CakePHP-ish by the way &#8220;hasManyAndBelongsToMany&#8221; :))) Can&#8217;t wait for part 3. Keep it up!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tominated</title>
		<link>http://anantgarg.com/2009/03/30/write-your-own-php-mvc-framework-part-2/comment-page-2/#comment-6113</link>
		<dc:creator>Tominated</dc:creator>
		<pubDate>Mon, 07 Jun 2010 11:09:02 +0000</pubDate>
		<guid isPermaLink="false">http://anantgarg.com/?p=200#comment-6113</guid>
		<description>Great tutorials that you've written! just a quick question: how would I go about including things like a login box or a dynamically generated menu in the header template for instance?
Thanks in advance!</description>
		<content:encoded><![CDATA[<p>Great tutorials that you&#8217;ve written! just a quick question: how would I go about including things like a login box or a dynamically generated menu in the header template for instance?<br />
Thanks in advance!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jade</title>
		<link>http://anantgarg.com/2009/03/30/write-your-own-php-mvc-framework-part-2/comment-page-2/#comment-5717</link>
		<dc:creator>Jade</dc:creator>
		<pubDate>Mon, 10 May 2010 03:40:47 +0000</pubDate>
		<guid isPermaLink="false">http://anantgarg.com/?p=200#comment-5717</guid>
		<description>Thank you! I like this tut so much! xxx</description>
		<content:encoded><![CDATA[<p>Thank you! I like this tut so much! xxx</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Traxk</title>
		<link>http://anantgarg.com/2009/03/30/write-your-own-php-mvc-framework-part-2/comment-page-2/#comment-4964</link>
		<dc:creator>Traxk</dc:creator>
		<pubDate>Tue, 16 Mar 2010 05:10:14 +0000</pubDate>
		<guid isPermaLink="false">http://anantgarg.com/?p=200#comment-4964</guid>
		<description>Hopefully, after almost a year, you'll be up for writing Part III which covers the user section of the framework...

I've been tinkering with the framework to get the user capability, but I seem to be doing something wrong... Any suggestions?

User-&gt;uname = $user;
		$this-&gt;User-&gt;pass = $pass;
		
		$loginData = $this-&gt;User-&gt;search();
		if(isset($loginData['User']['user_id']) &amp;&amp; $isset($loginData['User']['power_level'])){
			$_SESSION['v'] = "55a5ef54093e50c9d480bbeb254e4eaa";
			setSessionInfo($loginData, $_SESSION['v']);
			redirectAction('users','loginForm',array($returnHomeUrl)); /*redirect to home cp.*/
		}
		
		redirectAction('user','loginForm',array($returnUrl));  /*to the login page*/
		
	}
	
	private function setSessionInfo($loginData = null, $v = null){
		if($loginData == null &#124;&#124; $v == null){
			redirectAction('users','loginForm',array($returnUrl));  /*to the login page*/
		}
		$_SESSION['logged']=true;
		$_SESSION['level']=$loginData['User']['level'];
		$_SESSION['uid']=$loginData['User']['level'];
	
	}

	function view($uid = null) {
	}


	function afterAction() {

	}
}

Thanks!</description>
		<content:encoded><![CDATA[<p>Hopefully, after almost a year, you&#8217;ll be up for writing Part III which covers the user section of the framework&#8230;</p>
<p>I&#8217;ve been tinkering with the framework to get the user capability, but I seem to be doing something wrong&#8230; Any suggestions?</p>
<p>User-&gt;uname = $user;<br />
		$this-&gt;User-&gt;pass = $pass;</p>
<p>		$loginData = $this-&gt;User-&gt;search();<br />
		if(isset($loginData['User']['user_id']) &amp;&amp; $isset($loginData['User']['power_level'])){<br />
			$_SESSION['v'] = &#8220;55a5ef54093e50c9d480bbeb254e4eaa&#8221;;<br />
			setSessionInfo($loginData, $_SESSION['v']);<br />
			redirectAction(&#8217;users&#8217;,'loginForm&#8217;,array($returnHomeUrl)); /*redirect to home cp.*/<br />
		}</p>
<p>		redirectAction(&#8217;user&#8217;,'loginForm&#8217;,array($returnUrl));  /*to the login page*/</p>
<p>	}</p>
<p>	private function setSessionInfo($loginData = null, $v = null){<br />
		if($loginData == null || $v == null){<br />
			redirectAction(&#8217;users&#8217;,'loginForm&#8217;,array($returnUrl));  /*to the login page*/<br />
		}<br />
		$_SESSION['logged']=true;<br />
		$_SESSION['level']=$loginData['User']['level'];<br />
		$_SESSION['uid']=$loginData['User']['level'];</p>
<p>	}</p>
<p>	function view($uid = null) {<br />
	}</p>
<p>	function afterAction() {</p>
<p>	}<br />
}</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://anantgarg.com/2009/03/30/write-your-own-php-mvc-framework-part-2/comment-page-2/#comment-4879</link>
		<dc:creator>David</dc:creator>
		<pubDate>Fri, 05 Mar 2010 19:13:59 +0000</pubDate>
		<guid isPermaLink="false">http://anantgarg.com/?p=200#comment-4879</guid>
		<description>This is great tutorial for undestuding php framework and MVC programming.

Grat thanks !!</description>
		<content:encoded><![CDATA[<p>This is great tutorial for undestuding php framework and MVC programming.</p>
<p>Grat thanks !!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sam</title>
		<link>http://anantgarg.com/2009/03/30/write-your-own-php-mvc-framework-part-2/comment-page-2/#comment-4783</link>
		<dc:creator>sam</dc:creator>
		<pubDate>Sun, 21 Feb 2010 23:41:28 +0000</pubDate>
		<guid isPermaLink="false">http://anantgarg.com/?p=200#comment-4783</guid>
		<description>Hey Anant, 
i am using WAMP server 2, php3.0

i am getting this error on opening the site:

Notice: Undefined index: url in D:\wamp\www\todo-2\public\index.php on line 6

thats this line:       $url = $_GET['url'];

Deprecated: Assigning the return value of new by reference is deprecated in D:\wamp\www\todo-2\library\shared.php on line 148

Deprecated: Assigning the return value of new by reference is deprecated in D:\wamp\www\todo-2\library\shared.php on line 149



the url variable doesn't exist.
i get the same error in the part-1 also.
also i get the list of folders &amp; not redirected to the index.php in part-1.

PLZ tell me how do i proceed.</description>
		<content:encoded><![CDATA[<p>Hey Anant,<br />
i am using WAMP server 2, php3.0</p>
<p>i am getting this error on opening the site:</p>
<p>Notice: Undefined index: url in D:\wamp\www\todo-2\public\index.php on line 6</p>
<p>thats this line:       $url = $_GET['url'];</p>
<p>Deprecated: Assigning the return value of new by reference is deprecated in D:\wamp\www\todo-2\library\shared.php on line 148</p>
<p>Deprecated: Assigning the return value of new by reference is deprecated in D:\wamp\www\todo-2\library\shared.php on line 149</p>
<p>the url variable doesn&#8217;t exist.<br />
i get the same error in the part-1 also.<br />
also i get the list of folders &amp; not redirected to the index.php in part-1.</p>
<p>PLZ tell me how do i proceed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nikolay Traykov</title>
		<link>http://anantgarg.com/2009/03/30/write-your-own-php-mvc-framework-part-2/comment-page-2/#comment-4650</link>
		<dc:creator>Nikolay Traykov</dc:creator>
		<pubDate>Fri, 12 Feb 2010 00:08:55 +0000</pubDate>
		<guid isPermaLink="false">http://anantgarg.com/?p=200#comment-4650</guid>
		<description>Hi Anant,

Thank you for this wonderful tutorial. I complitely agree with you - there are many great frameworks, but if you want to learn how to make good oop design and to see what's inside this frameworks, you have to start working hard. That's why I've started working on one framework and saw your tutorial :). 
I have two questions to you and to everyone, who wants to answer: 
   1) I've created one front controller for my site, which acts as an entry point to it. The problem is that I have to put ajax, but I don't think, it would be good practise to invoke other php scipts as an entry point to my site, because of security reasons. Do you agree with me? Should I use the front controller for ajax too and after that create something like strategy pattern, which decides, whether it should invoke either classes which serves ajax requests or other classes, which serves to the non-ajax requests?
  2) I think to put any configurations in conf directory in xml files (or .properties files). Would it be safe for the website, because xml can be opened through browser? I will write a redirect to index.php in htaccess, but anyway I don't know that this is enough.

Thank you and good luck :)

Nikolay</description>
		<content:encoded><![CDATA[<p>Hi Anant,</p>
<p>Thank you for this wonderful tutorial. I complitely agree with you - there are many great frameworks, but if you want to learn how to make good oop design and to see what&#8217;s inside this frameworks, you have to start working hard. That&#8217;s why I&#8217;ve started working on one framework and saw your tutorial :).<br />
I have two questions to you and to everyone, who wants to answer:<br />
   1) I&#8217;ve created one front controller for my site, which acts as an entry point to it. The problem is that I have to put ajax, but I don&#8217;t think, it would be good practise to invoke other php scipts as an entry point to my site, because of security reasons. Do you agree with me? Should I use the front controller for ajax too and after that create something like strategy pattern, which decides, whether it should invoke either classes which serves ajax requests or other classes, which serves to the non-ajax requests?<br />
  2) I think to put any configurations in conf directory in xml files (or .properties files). Would it be safe for the website, because xml can be opened through browser? I will write a redirect to index.php in htaccess, but anyway I don&#8217;t know that this is enough.</p>
<p>Thank you and good luck <img src='http://anantgarg.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Nikolay</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lubaka</title>
		<link>http://anantgarg.com/2009/03/30/write-your-own-php-mvc-framework-part-2/comment-page-2/#comment-4571</link>
		<dc:creator>Lubaka</dc:creator>
		<pubDate>Fri, 05 Feb 2010 11:23:12 +0000</pubDate>
		<guid isPermaLink="false">http://anantgarg.com/?p=200#comment-4571</guid>
		<description>Very good tutorial. I have one question but first let explain what i have:
i have old working website his articles have very good postions on google and their links are file.php?id=123(id of article) now i want to make new website using this framework but i want to leaves those urls like they are and how to i redirect http://mysite.com/article/view/2/articlename to http://mysite.com/file.php?id=2 in this framework ? I want only this urls to be redirected. 
Again this is very good tutorial thank you.</description>
		<content:encoded><![CDATA[<p>Very good tutorial. I have one question but first let explain what i have:<br />
i have old working website his articles have very good postions on google and their links are file.php?id=123(id of article) now i want to make new website using this framework but i want to leaves those urls like they are and how to i redirect <a href="http://mysite.com/article/view/2/articlename" rel="nofollow">http://mysite.com/article/view/2/articlename</a> to <a href="http://mysite.com/file.php?id=2" rel="nofollow">http://mysite.com/file.php?id=2</a> in this framework ? I want only this urls to be redirected.<br />
Again this is very good tutorial thank you.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
