<?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/"
	>

<channel>
	<title>Jagadishwor's Blog</title>
	<atom:link href="http://www.jagadishwor.com.np/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jagadishwor.com.np</link>
	<description>A complete web tutorial for web designer, developer and beginners</description>
	<pubDate>Tue, 29 Jun 2010 10:52:51 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>20 Stunning Fonts From Deviantart</title>
		<link>http://www.jagadishwor.com.np/2010/06/20-stunning-fonts-from-deviantart/</link>
		<comments>http://www.jagadishwor.com.np/2010/06/20-stunning-fonts-from-deviantart/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 11:12:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Fonts]]></category>

		<guid isPermaLink="false">http://www.jagadishwor.com.np/?p=288</guid>
		<description><![CDATA[1. ABC - Font

2.  Advent Font:

3. Bolts Font

4. Comfortaa - Font:

5. Coreldraw

6.Denne Marker:

7. Drot_Sans

8. Evolution True Type Font

9. Fonce Sans Regular

10. VINEGAR

11. Geline font

12. Illegal Curves

13. K R A K E N - B E T A

14. Kaifo font

15. MDRS

16. Quarters Font

17. Regenerate Font

18. Surrounding

19. Rounded
http://mocon.deviantart.com/art/Rounded-158474463?q=favby%3Aawesome-fonts%
2F39159239&#38;qo=95
20. Thurston the Font

21. Consume or Die

View Also

Quick META [...]]]></description>
			<content:encoded><![CDATA[<p>1. ABC - Font</p>
<p><a href="http://myfox.deviantart.com/art/ABC-Font-Typeface-Version-2-96055350?q=favby%3Aawesome-fonts%2F39159239&amp;qo=46" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/ABC___Font_Typeface_Version_2_by_MyFox.jpg" alt="" width="500" height="750" /></a></p>
<p>2.  Advent Font:</p>
<p><a href="http://inde-graphics.deviantart.com/art/advent-font-57338302?q=favby%3Aawesome-fonts/39159239&amp;qo=50" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/advent_font_by_inde_graphics.jpg" alt="" width="500" height="521" /></a></p>
<p>3. Bolts Font</p>
<p><a href="http://jadegordon.deviantart.com/art/Bolts-Font-112588936?q=favby%3Aawesome-fonts%2F39159239&amp;qo=133" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/Bolts_Font_by_JadeGordon.gif" alt="" width="150" height="150" /></a></p>
<p>4. Comfortaa - Font:</p>
<p><a href="http://aajohan.deviantart.com/art/Comfortaa-font-105395949?q=gallery%3AAwesome-Fonts%2F24588690&amp;qo=0" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/Comfortaa___font_by_aajohan.jpg" alt="" width="500" height="700" /></a></p>
<p>5. Coreldraw</p>
<p><a href="http://weknow.deviantart.com/art/coreldrawfontx6-byweknow-163447517?q=gallery%3AAwesome-Fonts%2F24588690&amp;qo=3" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/coreldrawfontx6_byweknow_by_weknow.jpg" alt="" width="500" height="375" /></a></p>
<p>6.Denne Marker:</p>
<p><a href="http://deathmunkey.deviantart.com/art/Denne-Marker-76720603?q=favby%3Aawesome-fonts%2F39159239&amp;qo=33" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/Denne_Marker_by_deathmunkey.jpg" alt="" width="500" height="375" /></a></p>
<p>7. Drot_Sans</p>
<p><a href="http://darioart.deviantart.com/art/Drot-Sans-104658983?q=gallery%3AAwesome-Fonts%2F24588690&amp;qo=9" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/Drot_Sans_by_darioart.jpg" alt="" width="500" height="805" /></a></p>
<p>8. Evolution True Type Font</p>
<p><a href="http://paulw.deviantart.com/art/Evolution-True-Type-Font-83261584?q=favby%3Aawesome-fonts%2F39159239&amp;qo=51" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/Evolution_True_Type_Font_by_PAULW.jpg" alt="" width="500" height="731" /></a></p>
<p>9. Fonce Sans Regular</p>
<p><a href="http://liquisoft.deviantart.com/art/Fonce-Sans-Regular-Trial-25092730?q=favby%3Aawesome-fonts%2F39159239&amp;qo=49" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/Fonce_Sans_Regular_by_liquisoft.jpg" alt="" width="500" height="682" /></a></p>
<p>10. VINEGAR</p>
<p><a href="http://jelloween.deviantart.com/art/Font-VINEGAR-free-83101514?q=favby%" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/Font__VINEGAR___free_by_jelloween.png" alt="" width="500" height="707" /></a></p>
<p>11. Geline font</p>
<p><a href=" http://gelliroll.deviantart.com/art/Geline-font-92136653?q=boost%" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/Geline_font_by_gelliroll.jpg" alt="" width="326" height="254" /></a></p>
<p>12. Illegal Curves</p>
<p><a href="http://weslo11.deviantart.com/art/Illegal-Curves-Font-155785723?q=boost%" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/Illegal_Curves_Font_by_Weslo11.png" alt="" width="500" height="498" /></a></p>
<p>13. K R A K E N - B E T A</p>
<p><a href="http://twiggy8520.deviantart.com/art/K-R-A-K-E-N-B-E-T-A-110796306?" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/K_R_A_K_E_N___B_E_T_A_by_Twiggy8520.jpg" alt="" width="500" height="707" /></a></p>
<p>14. Kaifo font</p>
<p><a href="http://kailor.deviantart.com/art/Kaifo-font-59930342?q=favby%3Aawesome-fonts%" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/Kaifo_font_by_kailor.jpg" alt="" width="500" height="500" /></a></p>
<p>15. MDRS</p>
<p><a href="http://mindriders.deviantart.com/art/MDRS-FD01-112592193?q=favby%3Aawesome-" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/MDRS_FD01_by_mindriders.jpg" alt="" width="500" height="708" /></a></p>
<p>16. Quarters Font</p>
<p><a href="http://iamsla.deviantart.com/art/Quarters-font-TTF-66187331?q=boost%" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/Quarters_font_TTF_by_iamsla.jpg" alt="" width="500" height="705" /></a></p>
<p>17. Regenerate Font</p>
<p><a href="http://thinkluke.deviantart.com/art/regenerate-font-124658680?q=boost%" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/regenerate_font_by_thinkLuke.jpg" alt="" width="500" height="375" /></a></p>
<p>18. Surrounding</p>
<p><a href="http://bigyellowbiohazard.deviantart.com/art/surrounding-68530037?q=boost%" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/surrounding____by_BigYellowBiohazard.jpg" alt="" width="500" height="500" /></a></p>
<p>19. Rounded</p>
<p>http://mocon.deviantart.com/art/Rounded-158474463?q=favby%3Aawesome-fonts%</p>
<p>2F39159239&amp;qo=95</p>
<p>20. Thurston the Font</p>
<p><a href="http://sampratot.deviantart.com/art/Thurston-the-Font-60805063?q=favby%" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/Thurston_the_Font_by_sampratot.jpg" alt="" width="400" height="400" /></a></p>
<p>21. Consume or Die</p>
<p><img src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/cover_image.jpg" alt="" width="500" height="375" /><br />
<h3>View Also</h3>
<ul class="related_post">
<li><a href="http://www.jagadishwor.com.np/2009/02/download-official-google-seo-starter-guide-pdf/" title="Download Official Google SEO Starter Guide PDF">Download Official Google SEO Starter Guide PDF</a></li>
<li><a href="http://www.jagadishwor.com.np/2009/01/create-hit-counter-using-php/" title="Create hit counter Using php">Create hit counter Using php</a></li>
<li><a href="http://www.jagadishwor.com.np/2009/07/optimizing-png-for-the-web/" title="Optimizing PNG for the web">Optimizing PNG for the web</a></li>
<li><a href="http://www.jagadishwor.com.np/2009/08/auto-populating-select-boxes-using-jquery-ajax/" title="Auto-populating Select Boxes using jQuery &#038; AJAX ">Auto-populating Select Boxes using jQuery &#038; AJAX </a></li>
<li><a href="http://www.jagadishwor.com.np/2009/09/jquery-draggable/" title="jQuery Draggable">jQuery Draggable</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.jagadishwor.com.np/2010/06/20-stunning-fonts-from-deviantart/feed/</wfw:commentRss>
		</item>
		<item>
		<title>jQuery Zoom Effect on Hover</title>
		<link>http://www.jagadishwor.com.np/2010/06/jquery-zoom-effect-on-hover/</link>
		<comments>http://www.jagadishwor.com.np/2010/06/jquery-zoom-effect-on-hover/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 06:34:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[JQUERY]]></category>

		<category><![CDATA[jQuery Hover Zoom Effect]]></category>

		<category><![CDATA[jQuery Zoom Effect]]></category>

		<guid isPermaLink="false">http://www.jagadishwor.com.np/?p=284</guid>
		<description><![CDATA[1. sohtanaka

2. Chapagain

3. Realistic Hover Effect

4. PaperMashup

5. MattBango

6. Queness

7. Andreaslagerkvist

8. Zoomer Gallery

9. Tympanus

10. tympanus

View Also

CSS  Positioning, Layout and Understanding CSS z-index
JQuery Fade in And Fade Out Tutorial for Beginners
Understanding Ajax
PHP send email with an attachment
Key features of jQuery

]]></description>
			<content:encoded><![CDATA[<p>1. sohtanaka</p>
<p><a href="http://www.sohtanaka.com/web-design/examples/image-zoom/" target="_blank"><img longdesc="http://www.sohtanaka.com/web-design/examples/image-zoom/" src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/sothanka.jpg" alt="" width="500" height="242" /></a></p>
<p>2. Chapagain</p>
<p><a href="http://blog.chapagain.com.np/examples/image-preview-zoom/" target="_blank"><img longdesc="http://blog.chapagain.com.np/examples/image-preview-zoom/" src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/chapagain.jpg" alt="" width="500" height="252" /></a></p>
<p>3. Realistic Hover Effect</p>
<p><a href="http://adrianpelletier.com/sandbox/jquery_hover_nav/" target="_blank"><img longdesc="http://adrianpelletier.com/sandbox/jquery_hover_nav/" src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/ref.jpg" alt="" width="500" height="324" /></a></p>
<p>4. PaperMashup</p>
<p><a href="http://papermashup.com/demos/image-jquery/" target="_blank"><img longdesc="http://papermashup.com/demos/image-jquery/" src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/paper.jpg" alt="" width="500" height="157" /></a></p>
<p>5. MattBango</p>
<p><a href="http://mattbango.com/demos/hover-zoom/" target="_blank"><img longdesc="http://mattbango.com/demos/hover-zoom/" src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/mattbang.jpg" alt="" width="500" height="337" /></a></p>
<p>6. Queness</p>
<p><a href="http://www.queness.com/resources/html/zoomthumbnail/index.html" target="_blank"><img longdesc="http://www.queness.com/resources/html/zoomthumbnail/index.html" src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/que.jpg" alt="" width="500" height="515" /></a></p>
<p>7. Andreaslagerkvist</p>
<p><a href="http://andreaslagerkvist.com/jquery/image-zoom/" target="_blank"><img longdesc="http://andreaslagerkvist.com/jquery/image-zoom/" src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/and.jpg" alt="" width="500" height="338" /></a></p>
<p>8. Zoomer Gallery</p>
<p><a href="http://www.addyosmani.com/resources/zoomer/zoomer.html" target="_blank"><img longdesc="http://www.addyosmani.com/resources/zoomer/zoomer.html" src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/zoomergallery.jpg" alt="" width="500" height="349" /></a></p>
<p>9. Tympanus</p>
<p><a href="http://www.tympanus.net/Development/PhotoEffect/" target="_blank"><img longdesc="http://www.tympanus.net/Development/PhotoEffect/" src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/ne.jpg" alt="" width="500" height="288" /></a></p>
<p>10. tympanus</p>
<p><a href="http://www.tympanus.net/Tutorials/PhotoZoomOutEffect/" target="_blank"><img longdesc="http://www.tympanus.net/Tutorials/PhotoZoomOutEffect/" src="http://www.jagadishwor.com.np/wp-content/uploads/2010/06/tym.jpg" alt="" width="500" height="332" /></a><br />
<h3>View Also</h3>
<ul class="related_post">
<li><a href="http://www.jagadishwor.com.np/2009/02/quick-meta-keywords-wordpress-plugin/" title="Quick META Keywords Wordpress Plugin">Quick META Keywords Wordpress Plugin</a></li>
<li><a href="http://www.jagadishwor.com.np/2009/03/top-wordpress-theme-collected-by-themeheven/" title="Top Wordpress Theme Collected By Themeheven">Top Wordpress Theme Collected By Themeheven</a></li>
<li><a href="http://www.jagadishwor.com.np/2009/08/ajax-callbacks-with-jquery/" title="AJAX callbacks with jQuery">AJAX callbacks with jQuery</a></li>
<li><a href="http://www.jagadishwor.com.np/2009/01/php-find-the-visitors-details/" title="PHP find the visitors details">PHP find the visitors details</a></li>
<li><a href="http://www.jagadishwor.com.np/2008/06/why-the-header-tag-is-important-for-seo/" title="Why the header tag is important for SEO?">Why the header tag is important for SEO?</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.jagadishwor.com.np/2010/06/jquery-zoom-effect-on-hover/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PHP Array Functions</title>
		<link>http://www.jagadishwor.com.np/2010/02/php-array-functions/</link>
		<comments>http://www.jagadishwor.com.np/2010/02/php-array-functions/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 06:16:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.jagadishwor.com.np/?p=273</guid>
		<description><![CDATA[What is an Array?
An array is a data structure that stores one or more values in a single value. A variable can store only one data in memory. When we need to store more than one values we use Array to store data. Array understand data by its index. It&#8217;s a collection of elements having [...]]]></description>
			<content:encoded><![CDATA[<h3>What is an Array?</h3>
<p>An array is a data structure that stores one or more values in a single value. A variable can store only one data in memory. When we need to store more than one values we use Array to store data. Array understand data by its index. It&#8217;s a collection of elements having same name but different index.</p>
<p><span id="more-273"></span></p>
<p><strong><em>For Example:</em></strong></p>
<p><code> $var="PHP is good.";// Store only PHP is good.</p>
<p>$var=array("PHP is Good.", "I Like PHP");//Store both elements in $var variable. And when we need to retrieve data we can call its index like $var[0]. </code></p>
<p><em><strong>Syntax:</strong></em></p>
<p><code>$array("element1", "element2", " n element");</code></p>
<p><em>A simple Example of Array </em></p>
<p><code>&lt;?php</p>
<p>$arr=arry(10,20,30,40,50);</p>
<p>print_r($arr);//Prints Structure of Array.</p>
<p>?&gt;</code></p>
<h4><strong>Associative Array:</strong></h4>
<p><em>Array having string as a key is called an associative array. which means that it is a type that maps values to keys</em></p>
<p><em><strong>Example</strong></em></p>
<p><code>&lt;?php</p>
<p>$arr=array('a'=&gt;'apple', 'b'=&gt;'banana', 'c'=&gt;'cat');</p>
<p>echo ("Array Elements are &lt;br&gt;");</p>
<p>foreach($arr as $key=&gt;$val)</p>
<p>{</p>
<p>echo ("key:$key value: $val");</p>
<p>echo ("&lt;br&gt;");</p>
<p>}</p>
<p>?&gt;</code></p>
<p><strong>Sorting Numeric Array </strong></p>
<p><code>&lt;?php</p>
<p>$arr=array(25, 15, 5, 10, 20, 40, 30);</p>
<p>sort($arr);//Sorts an array in ascending order</p>
<p>echo ("Array elements in ascending order&lt;&gt;");</p>
<p>foreach($arr as $item){</p>
<p>echo ($item."&lt;br&gt;");</p>
<p>}</p>
<p>rsort($arr);//Sorts array in descending order</p>
<p>echo ("Array elements in descending order&lt;&gt;");</p>
<p>foreach($arr as $item){</p>
<p>echo ($item."&lt;br&gt;");</p>
<p>}</p>
<p>?&gt;</code></p>
<p><em> If a key is not specified for a value, the maximum of the integer indices is taken and the new key will be increment by 1. If a key that already has an assigned value is specified, that value will be overwritten. </em></p>
<p><strong><em>Example:</em></strong></p>
<p><code>&lt;?php</p>
<p>// This array is the same as ...</p>
<p>$a=array(5 =&gt; 43, 32, 56, "b" =&gt; 12);</p>
<p>foreach($a as $key=&gt;$val){</p>
<p>echo ("Key is $key, Value is $val&lt;br&gt;");</p>
<p>}</p>
<p>// ...this array</p>
<p>array(5 =&gt; 43, 6 =&gt; 32, 7 =&gt; 56, "b" =&gt; 12);</p>
<p>?&gt;</code></p>
<p><strong>Sorting Associative array: </strong></p>
<p><em>When sorting associative key asort() function removes the key of associative array and set index values. So when we need to sort associative array with key values we need to use <strong>asort() function</strong>. To sort according to key we can use <strong>ksort()</strong> for ascending order and <strong>krsort()</strong> for desecending order. <strong></p>
<p>Example:</strong></em></p>
<p><code> &lt;?php</p>
<p>$country=array("np"=&gt;"Nepal", "in"=&gt;"India", "us"=&gt;"America", "ch"=&gt;"China", "jp"=&gt;"Japan");</p>
<p>asort($country);//Sort associative array with key values.</p>
<p>foreach($country as $key=&gt;$val){</p>
<p>echo("$key =&gt; $val&lt;br&gt;");</p>
<p>}</p>
<p>arsort($country);//sorts associative array in descending order</p>
<p>echo ("&lt;br/&gt; Descending Order&lt;br&gt;");</p>
<p>foreach($country as $key=&gt;$val){</p>
<p>echo("$key=&gt;$val&lt;br&gt;");</p>
<p>}</p>
<p>?&gt;</code></p>
<p><em><strong>Shorting by key for ksort() and krsort: </strong></em></p>
<p><code><br />
&lt;?php</p>
<p>$country=array("np"=&gt;"Nepal", "in"=&gt;"India", "us"=&gt;"America", "ch"=&gt;"China", "jp"=&gt;"Japan");</p>
<p>ksort($country);//Sort associative array with key values.</p>
<p>foreach($country as $key=&gt;$val){</p>
<p>echo("$key =&gt; $val&lt;br&gt;");</p>
<p>}</p>
<p>krsort($country);//sorts associative array in descending order</p>
<p>echo ("&lt;br/&gt; Descending Order&lt;br&gt;");</p>
<p>foreach($country as $key=&gt;$val){</p>
<p>echo("$key=&gt;$val&lt;br&gt;");</p>
<p>}</p>
<p>?&gt;</code></p>
<h4><strong>Multidimensional Array:</strong></h4>
<p><em>The arrray having another arrays as its elements (OR arrays with in array) is called multidimensional array. That means If an array element value is an other array then this is a multidimensional array.</em></p>
<p><strong><em>For Example: </em></strong></p>
<p><code>$arr=array(array(10,20,30), array('a', 'b', 'c'), array(10.5, 15.2, 20.44)); </code></p>
<p><em><strong>Display and Sorting Multidimensional Array:</strong></em></p>
<p><code>&lt;?php</p>
<p>$arr=array(array(10,20,30), array('a', 'b', 'c'), array(10.5, 15.2, 20.44));</p>
<p>foreach($arr as $num)</p>
<p>{</p>
<p>foreach($num as $val)</p>
<p>{</p>
<p>echo ($val. "&lt;br&gt;");</p>
<p>}</p>
<p>echo ("&lt;br&gt;&lt;br&gt;");</p>
<p>}</p>
<p>?&gt;</p>
<p></code></p>
<p><em><strong>Sorting Multidimensional Array: </strong></em></p>
<p><code>&lt;?php</p>
<p>$arr=array(array(50,20,30), array('a', 'f', 'c'), array(17.5, 15.2, 20.44));</p>
<p>foreach($arr as $num)</p>
<p>{</p>
<p>sort($num);// Sort Array.</p>
<p>foreach($num as $val)</p>
<p>{</p>
<p>echo ($val. "&lt;br&gt;");</p>
<p>}</p>
<p>echo ("&lt;br&gt;&lt;br&gt;");</p>
<p>}</p>
<p>?&gt;</code><br />
<h3>Related Articles</h3>
<ul class="related_post">
<li><a href="http://www.jagadishwor.com.np/2009/12/10-simple-php-login-sytem-tutorial/" title="10 Simple PHP Login Sytem Tutorial ">10 Simple PHP Login Sytem Tutorial </a></li>
<li><a href="http://www.jagadishwor.com.np/2009/12/css-style-for-cms-system/" title="CSS style for CMS system">CSS style for CMS system</a></li>
<li><a href="http://www.jagadishwor.com.np/2009/11/php-mysql-own-cms-system-tutorial/" title="PHP Mysql own CMS system Tutorial">PHP Mysql own CMS system Tutorial</a></li>
<li><a href="http://www.jagadishwor.com.np/2009/10/php-image-file-upload-tutorial/" title="PHP Image File Upload Tutorial">PHP Image File Upload Tutorial</a></li>
<li><a href="http://www.jagadishwor.com.np/2009/09/php-simple-session-tutorial/" title="PHP Simple Session Tutorial">PHP Simple Session Tutorial</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.jagadishwor.com.np/2010/02/php-array-functions/feed/</wfw:commentRss>
		</item>
		<item>
		<title>JavaScript Enter Only Number onKeyPress Event</title>
		<link>http://www.jagadishwor.com.np/2010/02/javascript-enter-only-number-onkeypress-event/</link>
		<comments>http://www.jagadishwor.com.np/2010/02/javascript-enter-only-number-onkeypress-event/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 06:20:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.jagadishwor.com.np/?p=267</guid>
		<description><![CDATA[Today I am going to show some simple JavaScripts Which will allow user to enter only number in a textfield of your form. It will help you to restrict entering any other character besides numbers inside the text input field. The First Method allow you to validate a phone number which will allow user to [...]]]></description>
			<content:encoded><![CDATA[<p>Today I am going to show some simple JavaScripts Which will allow user to enter only number in a textfield of your form. It will help you to restrict entering any other character besides numbers inside the text input field. The First Method allow you to validate a phone number which will allow user to input numbers from 0-9 and characters &#8220;+()-&#8221;.</p>
<p><strong>First Method: </strong></p>
<p><em><strong>The Script </strong></em></p>
<p><code>&lt;script language="javascript"&gt;function forceNumber(event){</p>
<p></code></p>
<p><code>var keyCode = event.keyCode ? event.keyCode : event.charCode;if((keyCode &lt; 48 || keyCode &gt; 58) &amp;&amp; keyCode != 8 &amp;&amp; keyCode != 9 &amp;&amp; keyCode != 32 &amp;&amp; keyCode != 37 &amp;&amp; keyCode != 39 &amp;&amp; keyCode != 40 &amp;&amp; keyCode != 41 &amp;&amp; keyCode != 43 &amp;&amp; keyCode != 45 &amp;&amp; keyCode != 46)return false;}</p>
<p>&lt;/script&gt;</p>
<p></code></p>
<p><strong><span id="more-267"></span></strong>Form Field</p>
<p><code>&lt;input name="text" maxlength="17" onkeypress="return forceNumber(event);" /&gt;</code></p>
<p><strong>Second Method:</strong></p>
<p><em><strong>The Script </strong></em></p>
<p><code>&lt;SCRIPT language=Javascript&gt;function isNumberKey(evt){var charCode = (evt.which) ? evt.which : event.keyCodeif (charCode &gt; 31 &amp;&amp; (charCode &lt; 48 || charCode &gt; 57))</p>
<p>return false;</p>
<p>return true;</p>
<p>}</p>
<p>&lt;/SCRIPT&gt;</p>
<p></code></p>
<p><em><strong>Form Field </strong></em></p>
<p><code>&lt;input type ="text" name="number" id="numberfield" onkeypress="return isNumberKey(event)" &gt;</code><br />
<h3>Related Articles</h3>
<ul class="related_post">
<li><a href="http://www.jagadishwor.com.np/2009/09/select-all-and-deselect-all-checkbox-using-toggle-button/" title="Select All and Deselect All checkbox Using Toggle Button">Select All and Deselect All checkbox Using Toggle Button</a></li>
<li><a href="http://www.jagadishwor.com.np/2009/08/javascript-built-in-object-method-properties-handling-events-in-browser/" title="JavaScript Built in Object, Method, Properties &#038; Handling Events in browser">JavaScript Built in Object, Method, Properties &#038; Handling Events in browser</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.jagadishwor.com.np/2010/02/javascript-enter-only-number-onkeypress-event/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Object Oriented Programming with PHP</title>
		<link>http://www.jagadishwor.com.np/2010/01/object-oriented-programming-with-php/</link>
		<comments>http://www.jagadishwor.com.np/2010/01/object-oriented-programming-with-php/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 04:59:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

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

		<guid isPermaLink="false">http://www.jagadishwor.com.np/?p=258</guid>
		<description><![CDATA[&#8220;This tutorial is very best for OOP beginners. I found it&#8217;s very best. I think it will help all beginners who want to start OOP.&#8221;
by Kevin Waterson
Contents

What is OOP
What is an Object
What is a class
Commenting code
Inheritance (Extending a class)
Visibility (public, private, protected)
Final
Abstract Classes
Static Methods and properities
Interfaces
PHP Class Functions

get_declared_interaces()
get_class()
class_exists()
get_declared_classes()


Autoload
Serializing Objects
Overloading
Class Constants
Credits



What is OOP
OOP was first invented [...]]]></description>
			<content:encoded><![CDATA[<p><strong><em>&#8220;This tutorial is very best for OOP beginners. I found it&#8217;s very best. I think it will help all beginners who want to start OOP.&#8221;</em></strong></p>
<p><em>by Kevin Waterson</em></p>
<p>Contents</p>
<ol>
<li><a href="#1">What is OOP</a></li>
<li><a href="#2">What is an Object</a></li>
<li><a href="#3">What is a class</a></li>
<li><a href="#4">Commenting code</a></li>
<li><a href="#5">Inheritance (Extending a class)</a></li>
<li><a href="#6">Visibility (public, private, protected)</a></li>
<li><a href="#7">Final</a></li>
<li><a href="#8">Abstract Classes</a></li>
<li><a href="#9">Static Methods and properities</a></li>
<li><a href="#10">Interfaces</a></li>
<li><a href="#11">PHP Class Functions</a>
<ul>
<li><a href="#11.1">get_declared_interaces()</a></li>
<li><a href="#11.2">get_class()</a></li>
<li><a href="#11.2">class_exists()</a></li>
<li><a href="#11.2">get_declared_classes()</a></li>
</ul>
</li>
<li><a href="#12">Autoload</a></li>
<li><a href="#13">Serializing Objects</a></li>
<li><a href="#14">Overloading</a></li>
<li><a href="#15">Class Constants</a></li>
<li><a href="#77">Credits
<p></a></li>
</ol>
<p><span id="more-258"></span></p>
<h2><a class="anchor" name="1">What is OOP</a></h2>
<p>OOP was first invented for the purpose of physical modelling in the Simula-67.</p>
<p>Whilst there is no  hard and fast definition of what Object Oriented Programming (OOP) is, we can define. So lets just use this loose definition for now and it is left to reader to make up their own minds about what a decent definition is. Object Oriented Programming (OOP) is a programming concept that treats functions and data as objects. OK, not the best definition but gives us an opening. The key word here is objects. As we progress through this tutorial we will see how data and functions can be represented as re-usable objects, thus cutting down on code and time.</p>
<h2><a class="anchor" name="2">What is an Object</a></h2>
<p>Simply put, an oject is a bunch of variables and functions all lumped into a single entity. The object can then be called rather than calling the variables or functions themselves. Within an object there are methods and properties. The methods are functions that manipulate data withing the object. The properties are variables that hold information about the object.</p>
<h2><a class="anchor" name="3">What is a Class</a></h2>
<p>A class is the blueprint for your object. The class contains the methods and properties, or the charactaristics of the object. It defines the object. Lets just start with some examples to see how it all pieces together. We will use a vehicle as our object. All vehicles share similar charactaristics, eg: number of doors, they are painted some color, they each have a price. All vehicles do similar things also, drive, turn left, turn right, stop etc. These can be described as functions, or in OOP parlance, <span class="codechar">methods</span>. So, the class holds the definition, and the object holds the value. You declare class in PHP by using the <span class="codechar">class</span> keyword.</p>
<div class="codebox">
<p><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />
</span><span style="color: #007700">class </span><span style="color: #0000BB">vehicle</span><span style="color: #007700">{<br />
</span><span style="color: #FF8000">/*** define public properties ***//*** the color of the vehicle ***/<br />
<span style="color: #007700">public </span><span style="color: #0000BB">$color</span><span style="color: #007700">;<span style="color: #FF8000">/*** the number of doors ***/<br />
</span><span style="color: #007700">public </span><span style="color: #0000BB">$num_doors</span><span style="color: #007700">;<span style="color: #FF8000">/*** the price of the vehicle ***/<br />
</span><span style="color: #007700">public </span><span style="color: #0000BB">$price</span><span style="color: #007700">;<span style="color: #FF8000">/*** the shape of the vehicle ***/<br />
</span><span style="color: #007700">public </span><span style="color: #0000BB">$shape</span><span style="color: #007700">;<span style="color: #FF8000">/*** the brand of vehicle ***/<br />
</span><span style="color: #007700">public </span><span style="color: #0000BB">$brand</span><span style="color: #007700">;<span style="color: #FF8000">/*** the constructor ***/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">__construct</span><span style="color: #007700">(){<br />
echo </span><span style="color: #DD0000">&#8216;About this Vehicle.&lt;br /&gt;&#8217;</span><span style="color: #007700">;<br />
}<span style="color: #FF8000">/*** define some public methods ***//*** a method to show the vehicle price ***/<br />
<span style="color: #007700">public function </span><span style="color: #0000BB">showPrice</span><span style="color: #007700">(){<br />
echo </span><span style="color: #DD0000">&#8216;This vehicle costs &#8217;</span><span style="color: #007700">.</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">price</span><span style="color: #007700">.</span><span style="color: #DD0000">&#8216;.&lt;br /&gt;&#8217;</span><span style="color: #007700">;<br />
}<span style="color: #FF8000">/*** a method to show the number of doors ***/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">numDoors</span><span style="color: #007700">(){<br />
echo </span><span style="color: #DD0000">&#8216;This vehicle has &#8217;</span><span style="color: #007700">.</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_doors</span><span style="color: #007700">.</span><span style="color: #DD0000">&#8216; doors.&lt;br /&gt;&#8217;</span><span style="color: #007700">;<br />
}<span style="color: #FF8000">/*** method to drive the vehicle ***/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">drive</span><span style="color: #007700">(){<br />
echo </span><span style="color: #DD0000">&#8216;VRRROOOOOOM!!!&#8217;</span><span style="color: #007700">;<br />
}} <span style="color: #FF8000">/*** end of class ***/<br />
</span><span style="color: #0000BB">?&gt;</span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></code></div>
<p>With this simple class definition we can now create one, or many, vehicle objects. Lets see how its done, then we will step through it all. To create a new object from the class definition we use the <span class="codechar">new</span> keyword.</p>
<div class="codebox">
<p><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />
</span><span style="color: #FF8000">/*** create a new vehicle object ***/<br />
</span><span style="color: #0000BB">$vehicle </span><span style="color: #007700">= new </span><span style="color: #0000BB">vehicle</span><span style="color: #007700">;<span style="color: #FF8000">/*** the brand of vehicle ***/<br />
</span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">brand </span><span style="color: #007700">= </span><span style="color: #DD0000">&#8216;Porsche&#8217;</span><span style="color: #007700">;<span style="color: #FF8000">/*** the shape of vehicle ***/<br />
</span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">shape </span><span style="color: #007700">= </span><span style="color: #DD0000">&#8216;Coupe&#8217;</span><span style="color: #007700">;<span style="color: #FF8000">/*** the color of the vehicle ***/<br />
</span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">color </span><span style="color: #007700">= </span><span style="color: #DD0000">&#8216;Red&#8217;</span><span style="color: #007700">;<span style="color: #FF8000">/*** number of doors ***/<br />
</span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_doors </span><span style="color: #007700">= </span><span style="color: #0000BB">2</span><span style="color: #007700">;<span style="color: #FF8000">/*** cost of the vehicle ***/<br />
</span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">price </span><span style="color: #007700">= </span><span style="color: #0000BB">100000</span><span style="color: #007700">;<span style="color: #FF8000">/*** call the showPrice method ***/<br />
</span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">showPrice</span><span style="color: #007700">();<span style="color: #FF8000">/*** call the numDoors method ***/<br />
</span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">numDoors</span><span style="color: #007700">();<span style="color: #FF8000">/*** drive the vehicle ***/<br />
</span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">drive</span><span style="color: #007700">();<span style="color: #0000BB">?&gt;</span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></code></div>
<p>Using the combination of the two code boxes above, you should have something like..</p>
<p>About this vehicle.</p>
<p>This vehicle costs 100000.</p>
<p>This vehicle has 2 doors.</p>
<p>Lets step through the class definition first to see what its all about.</p>
<p>We began the class with the <span class="codechar">class</span> keyword. This tells PHP that what follows is a class definition.</p>
<div class="codebox">
<p><code><span style="color: #000000"><br />
<span style="color: #0000BB">&lt;?php<span style="color: #007700">class </span><span style="color: #0000BB">vehicle</span><span style="color: #007700">{<span style="color: #0000BB">?&gt;</span></p>
<p></span></p>
<p></span></span></code></div>
<p>Next we declared some variables, or as they are known in the OOP world, <span class="codechar">properties</span>.</p>
<div class="codebox"><code><span style="color: #000000"><br />
<span style="color: #0000BB">&lt;?php</p>
<p><span style="color: #FF8000">/*** the color of the vehicle ***/<br />
</span><span style="color: #007700">public </span><span style="color: #0000BB">$color</span><span style="color: #007700">;<span style="color: #FF8000">/*** the number of doors ***/<br />
</span><span style="color: #007700">public </span><span style="color: #0000BB">$num_doors</span><span style="color: #007700">;<span style="color: #FF8000">/*** the price of the vehicle ***/<br />
</span><span style="color: #007700">public </span><span style="color: #0000BB">$price</span><span style="color: #007700">;<span style="color: #FF8000">/*** the shape of the vehicle ***/<br />
</span><span style="color: #007700">public </span><span style="color: #0000BB">$shape</span><span style="color: #007700">;<span style="color: #FF8000">/*** the brand of vehicle ***/<br />
</span><span style="color: #007700">public </span><span style="color: #0000BB">$brand</span><span style="color: #007700">;<span style="color: #0000BB">?&gt;</span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></span></code></div>
<p>The properties are the individual charactaristics of the vehicle object. The <span class="codechar">public</span> declares that this property may be accessed within the public scope. This means you may set it from within your code. Next in the class definition is this code..</p>
<div class="codebox"><code><span style="color: #000000"><br />
<span style="color: #0000BB">&lt;?php</p>
<p><span style="color: #FF8000">/*** the constructor ***/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">__construct</span><span style="color: #007700">(){<br />
echo </span><span style="color: #DD0000">&#8216;About this vehicle.&lt;br /&gt;&#8217;</span><span style="color: #007700">;<br />
}<br />
</span><span style="color: #0000BB">?&gt;</span></p>
<p></span></span></code></div>
<p>The constructor method (function) is a special function that is executed every time a new object is created or &#8220;instantiated&#8221;. If a class needs to do something before running some code, then this is the place to do it. It is often used to set properties within the class. You may pass a variable directly to the constructor from your code, but more of that later. Following the constructor is several methods (functions) that do things. These methods are also preceded by the <span class="codechar">public</span> meaning they are available with the scope of your code.</p>
<div class="codebox"><code><span style="color: #000000"><br />
<span style="color: #0000BB">&lt;?php</p>
<p><span style="color: #FF8000">/*** a method to show the vehicle price ***/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">showPrice</span><span style="color: #007700">(){<br />
echo </span><span style="color: #DD0000">&#8216;This vehicle costs &#8217;</span><span style="color: #007700">.</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">price</span><span style="color: #007700">.</span><span style="color: #DD0000">&#8216;.&lt;br /&gt;&#8217;</span><span style="color: #007700">;<br />
}<span style="color: #FF8000">/*** a method to show the number of doors ***/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">numDoors</span><span style="color: #007700">(){<br />
echo </span><span style="color: #DD0000">&#8216;This vehicle has &#8217;</span><span style="color: #007700">.</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_doors</span><span style="color: #007700">.</span><span style="color: #DD0000">&#8216; doors.&lt;br /&gt;&#8217;</span><span style="color: #007700">;<br />
}<span style="color: #FF8000">/*** method to drive the vehicle ***/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">drive</span><span style="color: #007700">(){<br />
echo </span><span style="color: #DD0000">&#8216;VRRROOOOOOM&#8217;</span><span style="color: #007700">;<br />
}<span style="color: #0000BB">?&gt;</span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></span></code></div>
<p>As you see above, our methods are similar to normal PHP functions. However you may note the use of variables like $this-&gt;price and $this-&gt;num_doors. The keyword <span class="codechar">$this</span> is used to refer to properties or methods within the class itself. The <span class="codechar">$this</span> keyword is reserved in PHP, so it cannot be used as a variable or property name. Finally we finished our class definition with a closing <span class="codechar">}</span>. I like to put a comment beside it so I dont delete it or get it confused with a function I am writing.</p>
<p>Following on from the class definition we see our userland code. This is the code we use to instantiate (create) a new instance, or new object, of our vehicle class. As mentioned earlier we do this with the use of the <span class="codechar">new</span> keyword.</p>
<div class="codebox"><code><span style="color: #000000"><br />
<span style="color: #0000BB">&lt;?php</p>
<p><span style="color: #FF8000">/*** create a new vehicle object ***/<br />
</span><span style="color: #0000BB">$vehicle </span><span style="color: #007700">= new </span><span style="color: #0000BB">vehicle</span><span style="color: #007700">;<span style="color: #0000BB">?&gt;</span></p>
<p></span></p>
<p></span></span></code></div>
<p>The code above creates a new object from our class definition called <span class="codechar">$vehicle</span>. It is at this time that the constructor is called and any code within the constructor is executed. Once we have a new object we can then begin to assign values to the properties of that object as seen here.</p>
<div class="codebox"><code><span style="color: #000000"><br />
<span style="color: #0000BB">&lt;?php</p>
<p><span style="color: #FF8000">/*** the brand of vehicle ***/<br />
</span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">brand </span><span style="color: #007700">= </span><span style="color: #DD0000">&#8216;Porsche&#8217;</span><span style="color: #007700">;<span style="color: #FF8000">/*** the shape of vehicle ***/<br />
</span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">shape </span><span style="color: #007700">= </span><span style="color: #DD0000">&#8216;Coupe&#8217;</span><span style="color: #007700">;<span style="color: #FF8000">/*** the color of the vehicle ***/<br />
</span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">color </span><span style="color: #007700">= </span><span style="color: #DD0000">&#8216;Red&#8217;</span><span style="color: #007700">;<span style="color: #FF8000">/*** number of doors ***/<br />
</span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_doors </span><span style="color: #007700">= </span><span style="color: #0000BB">2</span><span style="color: #007700">;<span style="color: #0000BB">?&gt;</span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></span></code></div>
<p>With the properties set as above, it is now simple to use the object methods to manipulate the object by calling the methods. The methods are executed like this below.</p>
<div class="codebox"><code><span style="color: #000000"><br />
<span style="color: #0000BB">&lt;?php<br />
</span><span style="color: #FF8000">/*** call the showPrice method ***/<br />
</span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">showPrice</span><span style="color: #007700">();</p>
<p><span style="color: #FF8000">/*** call the numDoors method ***/<br />
</span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">numDoors</span><span style="color: #007700">();<span style="color: #FF8000">/*** drive the vehicle ***/<br />
</span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">drive</span><span style="color: #007700">();<br />
</span><span style="color: #0000BB">?&gt;</span></p>
<p></span></p>
<p></span></span></code></div>
<p>So, thats the step-by-step of your first class. You see how easy it would be now to create a new car object. Perhaps a Red Ferrari with 4 doors costing $250,000.00.</p>
<h2><a class="anchor" name="4">Commenting Code</a></h2>
<p>In the previous sections you have seen comments for almost every line of code. This is a good practice, although some may find it excessive, as it may not be you who has to edit the code next time. OOP can get very abstracted and if you are not careful it is easy to lose site of your programmatical work flow. Most methods within a class will return a value, rather than echo a line of HTML code. A class method may also take one, or several, arguements. It is good practice to show what these arguements are and there types. An example follows below.</p>
<div class="codebox"><code><span style="color: #000000"><br />
<span style="color: #0000BB">&lt;?php<br />
</span><span style="color: #FF8000">/**<br />
* adds an array of numbers and returns the value<br />
*<br />
* @param array $numbers An array of numbers to add<br />
*<br />
* @access private<br />
*<br />
* @return int Returns sum of numbers<br />
*<br />
*/<br />
</span><span style="color: #007700">private function </span><span style="color: #0000BB">sum_of_numbers</span><span style="color: #007700">(</span><span style="color: #0000BB">$numbers</span><span style="color: #007700">){<br />
</span><span style="color: #FF8000">/*** return the sum of the $numbers array ***/<br />
</span><span style="color: #007700">return </span><span style="color: #0000BB">array_sum</span><span style="color: #007700">(</span><span style="color: #0000BB">$numbers</span><span style="color: #007700">);<br />
}<br />
</span><span style="color: #0000BB">?&gt;</span><br />
</span><br />
</code></div>
<p>The above function is rather simplistic, but shows well the commenting of code. The comments begin in a block of C type multiline comments and gives us a brief description of what it does, followed by the parameter it takes, in this case an array of numbers. It tells us that access to the function is private (more on this in the next section). Finally the comment block tells us that the return value is of type INT. We can also see within the function itself a single line comment just to show what is happening within the funtion itself. If you follow these practices you code will always be readable and easy to follow by yourself and others.</p>
<h2><a class="anchor" name="5">Inheritance (Extending a class)</a></h2>
<p>Probably the greatest feature of the PHP OOP model is Inheritence. Inheritence is the ability of php to extend classes (child classes) that inherit the charactaristics of the parent class. The resulting object of an extend class has all the charactaristics of the parent class, plus whatever is in the new child, or extended class. In this instance we will extend the vehicle class and add a motorcyle. A motorcycle is still a vehicle and shares many of the same attributes such as price, drive etc. But a motorcycle has some unique features that a car does not.</p>
<p>Rather than type out the whole of the vehicle class definition again, we will save it in a file of its own called vehicle.class.php. It is important here to note the naming convention here as it will be important later in this tutorial. Lets see how it works.</p>
<div class="codebox"><code><span style="color: #000000"></p>
<p><span style="color: #0000BB">&lt;?php<span style="color: #FF8000">/*** include the vehicle class definition ***/<br />
</span><span style="color: #007700">include(</span><span style="color: #DD0000">&#8216;vehicle.class.php&#8217;</span><span style="color: #007700">);class <span style="color: #0000BB">motorcycle </span><span style="color: #007700">extends </span><span style="color: #0000BB">vehicle</span><span style="color: #007700">{<span style="color: #FF8000">/*** the number of side cars ***/<br />
</span><span style="color: #007700">private </span><span style="color: #0000BB">$num_sidecars</span><span style="color: #007700">;private <span style="color: #0000BB">$handlebars</span><span style="color: #007700">;<span style="color: #FF8000">/**<br />
*<br />
* set the type of handlebars<br />
*<br />
* @access public<br />
*<br />
* @param string<br />
*<br />
* @return string<br />
*<br />
**/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">setHandlebars</span><span style="color: #007700">(</span><span style="color: #0000BB">$handlebarType</span><span style="color: #007700">){<br />
</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">handlebars</span><span style="color: #007700">=</span><span style="color: #0000BB">$handlebarType</span><span style="color: #007700">;<br />
}<span style="color: #FF8000">/**<br />
*<br />
* Set number of side cars<br />
*<br />
* @access public<br />
*<br />
* @param int<br />
*<br />
* @return int<br />
*<br />
**/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">setSidecar</span><span style="color: #007700">(</span><span style="color: #0000BB">$numSidecars</span><span style="color: #007700">){<br />
</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">numSidecars </span><span style="color: #007700">= </span><span style="color: #0000BB">$numSidecars</span><span style="color: #007700">;<br />
}<span style="color: #FF8000">/**<br />
*<br />
* Show the numbers of sidecars<br />
*<br />
* @return string<br />
*<br />
**/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">showSideCar</span><span style="color: #007700">(){<br />
echo </span><span style="color: #DD0000">&#8216;This motorcyle has &#8217;</span><span style="color: #007700">. </span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">numSidecars</span><span style="color: #007700">.</span><span style="color: #DD0000">&#8216; sidecar&lt;br /&gt;&#8217;</span><span style="color: #007700">;<br />
}} <span style="color: #FF8000">/*** end of class ***//*** our userland code ***//*** create a new vehicle object ***/<br />
<span style="color: #0000BB">$vehicle </span><span style="color: #007700">= new </span><span style="color: #0000BB">motorcycle</span><span style="color: #007700">;<span style="color: #FF8000">/*** the brand of vehicle ***/<br />
</span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">brand </span><span style="color: #007700">= </span><span style="color: #DD0000">&#8216;Harley Davidson&#8217;</span><span style="color: #007700">;<span style="color: #FF8000">/*** the shape of vehicle ***/<br />
</span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">shape </span><span style="color: #007700">= </span><span style="color: #DD0000">&#8216;Sportster&#8217;</span><span style="color: #007700">;<span style="color: #FF8000">/*** the color of the vehicle ***/<br />
</span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">color </span><span style="color: #007700">= </span><span style="color: #DD0000">&#8216;Black&#8217;</span><span style="color: #007700">;<span style="color: #FF8000">/*** number of doors ***/<br />
</span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_doors </span><span style="color: #007700">= </span><span style="color: #0000BB">0</span><span style="color: #007700">;<span style="color: #FF8000">/*** cost of the vehicle ***/<br />
</span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">price </span><span style="color: #007700">= </span><span style="color: #0000BB">25000</span><span style="color: #007700">;<span style="color: #FF8000">/*** type of handle bars ***/<br />
</span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setHandlebars</span><span style="color: #007700">(</span><span style="color: #DD0000">&#8216;Ape Hangers&#8217;</span><span style="color: #007700">);<span style="color: #FF8000">/*** set the sidecar ***/<br />
</span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setSidecar</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">);<span style="color: #FF8000">/*** show the vehicle brand and type ***/<br />
</span><span style="color: #007700">echo </span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">brand</span><span style="color: #007700">.</span><span style="color: #DD0000">&#8216;: &#8217;</span><span style="color: #007700">.</span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">shape</span><span style="color: #007700">.</span><span style="color: #DD0000">&#8216;&lt;br /&gt;&#8217;</span><span style="color: #007700">;<span style="color: #FF8000">/*** call the showPrice method ***/<br />
</span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">showPrice</span><span style="color: #007700">();<span style="color: #FF8000">/*** show the sidecars ***/<br />
</span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">showSideCar</span><span style="color: #007700">();<span style="color: #FF8000">/*** drive the vehicle ***/<br />
</span><span style="color: #0000BB">$vehicle</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">drive</span><span style="color: #007700">();<span style="color: #0000BB">?&gt;<br />
</span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></code></div>
<p>You see in the motorcycle class that we have used the keyword <span class="codechar">extends</span> to extend our vehicle class. We can then proceed to set vars in the both the parent class and the child class. The child class has inherited all the characaristics of the parent vehicle class.</p>
<p>If you run the above code with out including the parent class, you will get a Fatal Error like this:</p>
<p>Fatal error: Class &#8216;vehicle&#8217; not found in /www/oop.php on line 3</p>
<h5>You MUST include the class definition on *every page* when you store an object</h5>
<p>This means when you use an object or wish to extend from it. you must include the class file. Either as code, or most commonly, with an include() statement.</p>
<h2><a class="anchor" name="6">Visibility (public, private, protected)</a></h2>
<p>The visibility of class members, (properties, methods), relates to how that member may be manipulated within, or from outside the class. Three levels of visibilty exist for class members.</p>
<ul>
<li>public</li>
<li>private</li>
<li>protected</li>
</ul>
<p>By default, all class members are public. This means if you do not declare a property or method within the class, it will be public. It is good practice to declare the visibility of class members for the sake of readability for yourself and others. It is much easier for another programmer to see your intentions. This will also future proof your scripts should access modifiers be deprecated.</p>
<p>Public class members (properties and methods) are available through-out the script and may be accessed from outside the class as we demonstrated in our car class. Lets create a simple new class to demonstrate.</p>
<div class="codebox"><code><span style="color: #000000"></p>
<p><span style="color: #0000BB">&lt;?php<span style="color: #007700">class </span><span style="color: #0000BB">mathematics</span><span style="color: #007700">{<br />
</span><span style="color: #FF8000">/*** a  number ***/<br />
</span><span style="color: #007700">public </span><span style="color: #0000BB">$num</span><span style="color: #007700">;<span style="color: #FF8000">/**<br />
*<br />
* Add two to a number<br />
*<br />
* @access public<br />
*<br />
* @return int<br />
*<br />
**/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">addTwo</span><span style="color: #007700">(){<br />
return </span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num</span><span style="color: #007700">+</span><span style="color: #0000BB">2</span><span style="color: #007700">;<br />
}}<span style="color: #FF8000">/*** end of class ***//*** Instantiate a new class instance ***/<br />
<span style="color: #0000BB">$math </span><span style="color: #007700">= new </span><span style="color: #0000BB">mathematics</span><span style="color: #007700">;<span style="color: #FF8000">/*** set the value of the number ***/<br />
</span><span style="color: #0000BB">$math</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num </span><span style="color: #007700">= </span><span style="color: #0000BB">2</span><span style="color: #007700">;<span style="color: #FF8000">/*** call the addTwo method ***/<br />
</span><span style="color: #007700">echo </span><span style="color: #0000BB">$math</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addTwo</span><span style="color: #007700">();<span style="color: #0000BB">?&gt;</span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></code></div>
<p>We can see in the above example that the public variable $num is set from user space and we call a public method that adds two the number and returns the value of $num+2. Having our properties (variables) visible, or accessible from any part of our script works in our favour here, but it can also work against us. A could arise if we lost track of our values and changed the value of $num. To counter this problem we can create a method to set the value for us. Even with this in place it is still possible for somebody to simply access the $num variable. So we make the variable private. This ensures us that the property is only available within the class itself. It is private to the calling class. Consider the following code.</p>
<div class="codebox"><code><span style="color: #000000"></p>
<p><span style="color: #0000BB">&lt;?php<span style="color: #007700">class </span><span style="color: #0000BB">mathematics</span><span style="color: #007700">{<span style="color: #FF8000">/*** a  number ***/<br />
</span><span style="color: #007700">private </span><span style="color: #0000BB">$num</span><span style="color: #007700">;<span style="color: #FF8000">/**<br />
*<br />
* Set the value of $num<br />
*<br />
* @access public<br />
*<br />
* @param $num The number to set<br />
*<br />
* @return int<br />
*<br />
**/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">setNum</span><span style="color: #007700">(</span><span style="color: #0000BB">$num</span><span style="color: #007700">){<br />
</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num </span><span style="color: #007700">= </span><span style="color: #0000BB">$num</span><span style="color: #007700">;<br />
}<span style="color: #FF8000">/**<br />
*<br />
* Add two to a number<br />
*<br />
* @access public<br />
*<br />
* @return int<br />
*<br />
**/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">addTwo</span><span style="color: #007700">(){<br />
return </span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num</span><span style="color: #007700">+</span><span style="color: #0000BB">2</span><span style="color: #007700">;<br />
}}<span style="color: #FF8000">/*** end of class ***//*** Instantiate a new class instance ***/<br />
<span style="color: #0000BB">$math </span><span style="color: #007700">= new </span><span style="color: #0000BB">mathematics</span><span style="color: #007700">;<span style="color: #FF8000">/*** set the value of the number ***/<br />
</span><span style="color: #0000BB">$math</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setNum</span><span style="color: #007700">(</span><span style="color: #0000BB">2</span><span style="color: #007700">);<span style="color: #FF8000">/*** call the addTwo method ***/<br />
</span><span style="color: #007700">echo </span><span style="color: #0000BB">$math</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addTwo</span><span style="color: #007700">();<span style="color: #0000BB">?&gt;<br />
</span><br />
?&gt;</p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></code></div>
<p>Any further attempt to reset the $num property without the setNum() method would result in a Fatal Error such as</p>
<p>Fatal error: Cannot access private property mathematics::$num in /www/mathematics.class.php on line 43</p>
<p>Even if you were to try to access the private $num property from a child class it would fail. This is because private methods and properties in a parent class are not visible to child classes and cannot be accessed. To access a parent method or property from a child class you need to use the <span class="codechar">protected</span> keyword. Like the private keyword, protetected methods and properties are available only to the class that created them. But unlike private, protected methods and properties are visible from a parent class. Lets see how this works.</p>
<div class="codebox"><code><span style="color: #000000"><br />
<span style="color: #0000BB">&lt;?php</p>
<p><span style="color: #007700">class </span><span style="color: #0000BB">mathematics</span><span style="color: #007700">{<br />
</span><span style="color: #FF8000">/*** a  number ***/<br />
</span><span style="color: #007700">protected </span><span style="color: #0000BB">$num</span><span style="color: #007700">;<span style="color: #FF8000">/**<br />
*<br />
* Set the value of $num<br />
*<br />
* @access public<br />
*<br />
* @param $num The number to set<br />
*<br />
* @return int<br />
*<br />
**/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">setNum</span><span style="color: #007700">(</span><span style="color: #0000BB">$num</span><span style="color: #007700">){<br />
</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num </span><span style="color: #007700">= </span><span style="color: #0000BB">$num</span><span style="color: #007700">;<br />
}<span style="color: #FF8000">/**<br />
*<br />
* Add two to a number<br />
*<br />
* @access public<br />
*<br />
* @return int<br />
*<br />
**/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">addTwo</span><span style="color: #007700">(){<br />
return </span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num</span><span style="color: #007700">+</span><span style="color: #0000BB">2</span><span style="color: #007700">;<br />
}}<span style="color: #FF8000">/*** end of class ***/<span style="color: #007700">class </span><span style="color: #0000BB">divide </span><span style="color: #007700">extends </span><span style="color: #0000BB">mathematics</span><span style="color: #007700">{<span style="color: #FF8000">/**<br />
*<br />
* Divide a number by two<br />
*<br />
* @access public<br />
*<br />
* @return int<br />
*<br />
**/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">divideByTwo</span><span style="color: #007700">(){<br />
</span><span style="color: #FF8000">/*** divide number by two ***/<br />
</span><span style="color: #0000BB">$new_num </span><span style="color: #007700">= </span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num</span><span style="color: #007700">/</span><span style="color: #0000BB">2</span><span style="color: #007700">;<br />
</span><span style="color: #FF8000">/*** return the new number and round to 2 decimal places ***/<br />
</span><span style="color: #007700">return </span><span style="color: #0000BB">round</span><span style="color: #007700">(</span><span style="color: #0000BB">$new_num</span><span style="color: #007700">, </span><span style="color: #0000BB">2</span><span style="color: #007700">);<br />
}} <span style="color: #FF8000">/*** end of class ***//*** Instantiate a new class instance ***/<br />
<span style="color: #0000BB">$math </span><span style="color: #007700">= new </span><span style="color: #0000BB">divide</span><span style="color: #007700">;<span style="color: #FF8000">/*** set the value of the number ***/<br />
</span><span style="color: #0000BB">$math</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setNum</span><span style="color: #007700">(</span><span style="color: #0000BB">14</span><span style="color: #007700">);echo <span style="color: #0000BB">$math</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">divideByTwo</span><span style="color: #007700">();<span style="color: #0000BB">?&gt;</span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></span></code></div>
<p>We can see here the the user space code has called the setNum() method in the parent mathematics class. This method, in turn, sets the $num property. We are able to do this because the $num property has been declared protected and is visible to the child class.</p>
<h2><a class="anchor" name="7">Final</a></h2>
<p>As we saw in the previous section there are ways to protect your code from being used in an improper manner. Another way of protecting yourself is the <span class="codechar">Final</span> keyword. Any method or class that is declared as Final cannot be overridden or inherited by another class. Lets put it to the test.</p>
<div class="codebox"><code><span style="color: #000000"><br />
<span style="color: #0000BB">&lt;?php</p>
<p><span style="color: #007700">final class </span><span style="color: #0000BB">mathematics</span><span style="color: #007700">{} <span style="color: #FF8000">/*** end of class ***/<span style="color: #007700">class </span><span style="color: #0000BB">divide </span><span style="color: #007700">extends </span><span style="color: #0000BB">mathematics</span><span style="color: #007700">{}<span style="color: #0000BB">?&gt;</span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></span></code></div>
<p>By running the above code you will get an error such as</p>
<p>Fatal error: Class divide may not inherit from final class (mathematics) in /www/final.php on line 8</p>
<p>This can protect us from those who wish to use our code for a purpose other than that for which it was intended.</p>
<h2><a class="anchor" name="8">Abstract Classes</a></h2>
<p>An abstract class is a class that cannot be instantiated on its own. You cannot create a new object from it. To see this lets make a basic class.</p>
<div class="codebox">
<p><code><span style="color: #000000"><br />
<span style="color: #0000BB">&lt;?php<span style="color: #007700">abstract class </span><span style="color: #0000BB">mathematics</span><span style="color: #007700">{<span style="color: #FF8000">/**<br />
*<br />
* Add two to a number<br />
*<br />
* @access public<br />
*<br />
* @return int<br />
*<br />
**/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">addTwo</span><span style="color: #007700">(){<br />
return </span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num</span><span style="color: #007700">+</span><span style="color: #0000BB">2</span><span style="color: #007700">;<br />
}} <span style="color: #FF8000">/*** end of class ***//*** try to create new object from the mathematics class ***/<br />
<span style="color: #0000BB">$math </span><span style="color: #007700">= new </span><span style="color: #0000BB">mathematics?&gt;</p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></span></code></div>
<p>Using the code above, you will get an error something like this</p>
<p>Fatal error: Cannot instantiate abstract class mathematics in /www/abstract.php on line 23.</p>
<p>As you can see, this is not allowed. Also if you declare any class method to be abstract, you must also declare the class itself as abstract too. So, whats the point you ask? Well, you can inherit from an abstract class. Any class that extends an abstract parent class must create an interface of the parent abstract methods. If this is not done a fatal error is generated. This ensures that the implementation is correct.</p>
<div class="codebox">
<p><code><span style="color: #000000"><br />
<span style="color: #0000BB">&lt;?php<span style="color: #007700">abstract class </span><span style="color: #0000BB">mathematics</span><span style="color: #007700">{<br />
</span><span style="color: #FF8000">/*** child class must define these methods ***/<br />
</span><span style="color: #007700">abstract protected function </span><span style="color: #0000BB">getMessage</span><span style="color: #007700">();abstract protected function <span style="color: #0000BB">addTwo</span><span style="color: #007700">(</span><span style="color: #0000BB">$num1</span><span style="color: #007700">);<span style="color: #FF8000">/**<br />
*<br />
* method common to both classes<br />
*<br />
**/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">showMessage</span><span style="color: #007700">() {<br />
echo </span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getMessage</span><span style="color: #007700">();<br />
}} <span style="color: #FF8000">/*** end of class ***/<span style="color: #007700">class </span><span style="color: #0000BB">myMath </span><span style="color: #007700">extends </span><span style="color: #0000BB">mathematics</span><span style="color: #007700">{<br />
</span><span style="color: #FF8000">/**<br />
*<br />
* Prefix to the answer<br />
*<br />
* @return string<br />
*<br />
**/<br />
</span><span style="color: #007700">protected function </span><span style="color: #0000BB">getMessage</span><span style="color: #007700">(){<br />
return </span><span style="color: #DD0000">&#8220;The anwser is: &#8221;</span><span style="color: #007700">;<br />
}<span style="color: #FF8000">/**<br />
*<br />
* add two to a number<br />
*<br />
* @access public<br />
*<br />
* @param $num1 A number to be added to<br />
*<br />
* @return int<br />
*<br />
**/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">addTwo</span><span style="color: #007700">(</span><span style="color: #0000BB">$num1</span><span style="color: #007700">) {<br />
return </span><span style="color: #0000BB">$num1</span><span style="color: #007700">+</span><span style="color: #0000BB">2</span><span style="color: #007700">;<br />
}} <span style="color: #FF8000">/*** end of class ***//*** a new instance of myMath ***/<br />
<span style="color: #0000BB">$myMath </span><span style="color: #007700">= new </span><span style="color: #0000BB">myMath</span><span style="color: #007700">;<br />
</span><span style="color: #FF8000">/*** show the message ***/<br />
</span><span style="color: #0000BB">$myMath</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">showMessage</span><span style="color: #007700">();<br />
</span><span style="color: #FF8000">/*** do the math ***/<br />
</span><span style="color: #007700">echo </span><span style="color: #0000BB">$myMath</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addTwo</span><span style="color: #007700">(</span><span style="color: #0000BB">4</span><span style="color: #007700">);<span style="color: #0000BB">?&gt;</span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></span></code></div>
<h2><a class="anchor" name="9">Static Methods and Properties</a></h2>
<p>The use of the <span class="codechar">static</span> keyword allows class members (methods and properties) to be used without needing to instantiate a new instance of the class. The static declaratin must come after the visibility declaration, eg:</p>
<p>public static myClass{</p>
<p>Because there is no object created when using a static call, the keyword <span class="codechar">$this</span> and the arrow operator, <span class="codechar">-&gt;</span> are not available. Static variables belong to the class itself and not to any object of that class. To access withing the class itself you need to use the <span class="codechar">self</span> keyword along with the <span class="codechar">::</span> scope resolution operator. Lets whip up a quick example of using static.</p>
<div class="codebox">
<p><code><span style="color: #000000"><br />
<span style="color: #0000BB">&lt;?php<br />
</span><span style="color: #FF8000">/*** a simple class ***/<br />
</span><span style="color: #007700">class </span><span style="color: #0000BB">myClass</span><span style="color: #007700">{<br />
</span><span style="color: #FF8000">/*** a static variable ***/<br />
</span><span style="color: #007700">static </span><span style="color: #0000BB">$foo</span><span style="color: #007700">;<br />
}<span style="color: #FF8000">/** give the static variable a value ***/<br />
</span><span style="color: #0000BB">myClass</span><span style="color: #007700">::</span><span style="color: #0000BB">$foo </span><span style="color: #007700">= </span><span style="color: #DD0000">&#8216;Bar&#8217;</span><span style="color: #007700">;<span style="color: #FF8000">/*** echo the static variable ***/<br />
</span><span style="color: #007700">echo (</span><span style="color: #0000BB">myClass</span><span style="color: #007700">::</span><span style="color: #0000BB">$foo </span><span style="color: #007700">).<br />
</span><span style="color: #0000BB">?&gt;<br />
</span></p>
<p></span></p>
<p></span></span></code></div>
<p>The above snippet will echo</p>
<p>Bar</p>
<p>This is rather basic as an example, so lets use something practical. Static properties are often used as counters. Here we will use a basic counter class.</p>
<div class="codebox">
<p><code><span style="color: #000000"><br />
<span style="color: #0000BB">&lt;?php<br />
</span><span style="color: #007700">class </span><span style="color: #0000BB">counter</span><span style="color: #007700">{<span style="color: #FF8000">/*** our count variable ***/<br />
</span><span style="color: #007700">private static </span><span style="color: #0000BB">$count </span><span style="color: #007700">= </span><span style="color: #0000BB">0</span><span style="color: #007700">;<span style="color: #FF8000">/**<br />
* Constructor, duh<br />
**/<br />
</span><span style="color: #007700">function </span><span style="color: #0000BB">__construct</span><span style="color: #007700">() {<br />
</span><span style="color: #0000BB">self</span><span style="color: #007700">::</span><span style="color: #0000BB">$count</span><span style="color: #007700">++;<br />
}<span style="color: #FF8000">/**<br />
*<br />
* get the current count<br />
*<br />
* @access public<br />
*<br />
* @return int<br />
*<br />
**/<br />
</span><span style="color: #007700">public static function </span><span style="color: #0000BB">getCount</span><span style="color: #007700">() {<br />
return </span><span style="color: #0000BB">self</span><span style="color: #007700">::</span><span style="color: #0000BB">$count</span><span style="color: #007700">;<br />
}} <span style="color: #FF8000">/*** end of class ***//*** create a new instance ***/<br />
<span style="color: #0000BB">$count </span><span style="color: #007700">= new </span><span style="color: #0000BB">counter</span><span style="color: #007700">();<br />
</span><span style="color: #FF8000">/*** get the count ***/<br />
</span><span style="color: #007700">echo </span><span style="color: #0000BB">counter</span><span style="color: #007700">::</span><span style="color: #0000BB">getCount</span><span style="color: #007700">() . </span><span style="color: #DD0000">&#8216;&lt;br /&gt;&#8217;</span><span style="color: #007700">;<br />
</span><span style="color: #FF8000">/*** create another instance ***/<br />
</span><span style="color: #0000BB">$next </span><span style="color: #007700">= new </span><span style="color: #0000BB">counter</span><span style="color: #007700">();<br />
</span><span style="color: #FF8000">/*** echo the new count ***/<br />
</span><span style="color: #007700">echo </span><span style="color: #0000BB">counter</span><span style="color: #007700">::</span><span style="color: #0000BB">getCount</span><span style="color: #007700">().</span><span style="color: #DD0000">&#8216;&lt;br /&gt;&#8217;</span><span style="color: #007700">;<br />
</span><span style="color: #FF8000">/*** and a third instance ***/<br />
</span><span style="color: #0000BB">$third </span><span style="color: #007700">= new </span><span style="color: #0000BB">counter</span><span style="color: #007700">;<br />
echo </span><span style="color: #0000BB">counter</span><span style="color: #007700">::</span><span style="color: #0000BB">getCount</span><span style="color: #007700">().</span><span style="color: #DD0000">&#8216;&lt;br /&gt;&#8217;</span><span style="color: #007700">;<br />
</span><span style="color: #0000BB">?&gt;</span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></span></code></div>
<p>Hopefully by the end of the above snippet you can see what is happening. At each new instance the counter class we increment by one. Not also the use of the <span class="codechar">::</span> scope resolution operator and <span class="codechar">self</span> keyword to refer to the static variable within the class itself.</p>
<h2><a class="anchor" name="10">Interfaces</a></h2>
<p>Interfaces in PHP allow you to define a common structure for your classes. An interface cannot be instantiated on its own. One of the goals of OOP is re-use of code. Interfaces make this a much easier process. The interface methods have no internal logic, they are simply a &#8220;mapping&#8221; or constraint of what the class, or classes, should implement. Here we will demonstrate how this works using our vehicle class from earlier, with the addition of a stop() function.</p>
<div class="codebox">
<p><code><span style="color: #000000"><br />
<span style="color: #0000BB">&lt;?php<br />
</span><span style="color: #007700">class </span><span style="color: #0000BB">vehicle </span><span style="color: #007700">implements </span><span style="color: #0000BB">testdrive</span><span style="color: #007700">{<span style="color: #FF8000">/*** define public properties ***//*** the color of the vehicle ***/<br />
<span style="color: #007700">public </span><span style="color: #0000BB">$color</span><span style="color: #007700">;<span style="color: #FF8000">/*** the number of doors ***/<br />
</span><span style="color: #007700">public </span><span style="color: #0000BB">$num_doors</span><span style="color: #007700">;<span style="color: #FF8000">/*** the price of the vehicle ***/<br />
</span><span style="color: #007700">public </span><span style="color: #0000BB">$price</span><span style="color: #007700">;<span style="color: #FF8000">/*** the shape of the vehicle ***/<br />
</span><span style="color: #007700">public </span><span style="color: #0000BB">$shape</span><span style="color: #007700">;<span style="color: #FF8000">/*** the brand of vehicle ***/<br />
</span><span style="color: #007700">public </span><span style="color: #0000BB">$brand</span><span style="color: #007700">;<span style="color: #FF8000">/*** the constructor ***/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">__construct</span><span style="color: #007700">(){<br />
echo </span><span style="color: #DD0000">&#8216;About this Vehicle.&lt;br /&gt;&#8217;</span><span style="color: #007700">;<br />
}<span style="color: #FF8000">/*** define some public methods ***//*** a method to show the vehicle price ***/<br />
<span style="color: #007700">public function </span><span style="color: #0000BB">showPrice</span><span style="color: #007700">(){<br />
echo </span><span style="color: #DD0000">&#8216;This vehicle costs &#8217;</span><span style="color: #007700">.</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">price</span><span style="color: #007700">.</span><span style="color: #DD0000">&#8216;.&lt;br /&gt;&#8217;</span><span style="color: #007700">;<br />
}<span style="color: #FF8000">/*** a method to show the number of doors ***/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">numDoors</span><span style="color: #007700">(){<br />
echo </span><span style="color: #DD0000">&#8216;This vehicle has &#8217;</span><span style="color: #007700">.</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_doors</span><span style="color: #007700">.</span><span style="color: #DD0000">&#8216; doors.&lt;br /&gt;&#8217;</span><span style="color: #007700">;<br />
}<span style="color: #FF8000">/*** method to drive the vehicle ***/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">drive</span><span style="color: #007700">(){<br />
echo </span><span style="color: #DD0000">&#8216;VRRROOOOOOM!!!&#8217;</span><span style="color: #007700">;<br />
}<br />
</span><span style="color: #FF8000">/**<br />
* a method to stop the car<br />
*<br />
* @access public<br />
*<br />
**/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">stop</span><span style="color: #007700">(){<br />
echo </span><span style="color: #DD0000">&#8216;SSSCCRRREEEEEECCHH!!!&lt;br /&gt;&#8217;</span><span style="color: #007700">;<br />
}} <span style="color: #FF8000">/*** end of class ***//*** declare our interface ***/<br />
<span style="color: #007700">interface </span><span style="color: #0000BB">testdrive</span><span style="color: #007700">{<br />
</span><span style="color: #FF8000">/*** some functions that must be implemented ***/<br />
</span><span style="color: #007700">function </span><span style="color: #0000BB">drive</span><span style="color: #007700">();<br />
function </span><span style="color: #0000BB">stop</span><span style="color: #007700">();<br />
}<span style="color: #FF8000">/*** an new vehicle object ***/<br />
</span><span style="color: #0000BB">$object </span><span style="color: #007700">= new </span><span style="color: #0000BB">vehicle</span><span style="color: #007700">;<span style="color: #FF8000">/*** call some methods ***/<br />
</span><span style="color: #0000BB">$object</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">drive</span><span style="color: #007700">();<br />
</span><span style="color: #0000BB">$object</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">stop</span><span style="color: #007700">();<br />
</span><span style="color: #0000BB">?&gt;</span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></span></code></div>
<p>You may of course create multiple classes to implement your interface, but they will not inherit from each other. When you inherit from a parent class, you may choose to override some of parent methods. If you had multiple parent class methods with the same name, but different functionality or charactaristics, PHP would have no way of telling which of these methods to use. This is why multiple inheritance does not work in PHP. In contrast, classes that implement an interface, must implement every method so there is no ambiguity.</p>
<p>In the real world interfaces provide us with the tools harness parts of multiple classes. Consider this scenario. If we had two classes, one for a fax and the other for a printer. Each has seperate uses and could be described like this:</p>
<div class="codebox"><code><span style="color: #000000"></p>
<p><span style="color: #0000BB">&lt;?php<br />
</span><span style="color: #007700">class </span><span style="color: #0000BB">fax</span><span style="color: #007700">{<br />
public function </span><span style="color: #0000BB">dial</span><span style="color: #007700">();<br />
public function </span><span style="color: #0000BB">send</span><span style="color: #007700">();<br />
public function </span><span style="color: #0000BB">recieve</span><span style="color: #007700">();<br />
}class <span style="color: #0000BB">printer</span><span style="color: #007700">{<br />
public function </span><span style="color: #0000BB">printBlack</span><span style="color: #007700">();<br />
public function </span><span style="color: #0000BB">printColor</span><span style="color: #007700">();<br />
public function </span><span style="color: #0000BB">printDraft</span><span style="color: #007700">();<br />
}<br />
</span><span style="color: #0000BB">?&gt;<br />
</span></p>
<p></span></p>
<p></span></code></div>
<p>Both of the above classes give the required usage for each item, but they do not take into consideration the existance of a printer/fax machine. To get the usage of both classes we would do something like this:</p>
<div class="codebox"><code><span style="color: #000000"></p>
<p><span style="color: #0000BB">&lt;?php<br />
</span><span style="color: #007700">class </span><span style="color: #0000BB">fax</span><span style="color: #007700">{<br />
public function </span><span style="color: #0000BB">dial</span><span style="color: #007700">();<br />
public function </span><span style="color: #0000BB">send</span><span style="color: #007700">();<br />
public function </span><span style="color: #0000BB">recieve</span><span style="color: #007700">();<br />
}class <span style="color: #0000BB">printer </span><span style="color: #007700">extends </span><span style="color: #0000BB">fax</span><span style="color: #007700">{<br />
public function </span><span style="color: #0000BB">printBlack</span><span style="color: #007700">();<br />
public function </span><span style="color: #0000BB">printColor</span><span style="color: #007700">();<br />
public function </span><span style="color: #0000BB">printDraft</span><span style="color: #007700">();<br />
public function </span><span style="color: #0000BB">kick</span><span style="color: #007700">();<br />
}class <span style="color: #0000BB">printerFax </span><span style="color: #007700">extends </span><span style="color: #0000BB">fax</span><span style="color: #007700">{<br />
}<span style="color: #0000BB">$object </span><span style="color: #007700">= new </span><span style="color: #0000BB">printerFax</span><span style="color: #007700">;<br />
</span><span style="color: #0000BB">?&gt;<br />
</span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></code></div>
<p>This code works by creating a stack of classes. The grandparent class is fax. Then the printer class extends the fax class and inherits all the methods from that class. This is where some problems may arise. The printer class now has the function dial() available to it which is clearly going to cause some confusion and possibly errors in logic.</p>
<p>To counter this problem an interface can be used to tell the classes what functions (methods) are required. Lets look at the design.</p>
<div class="codebox"><code><span style="color: #000000"></p>
<p><span style="color: #0000BB">&lt;?php<br />
</span><span style="color: #007700">interface </span><span style="color: #0000BB">fax</span><span style="color: #007700">{<br />
public function </span><span style="color: #0000BB">dial</span><span style="color: #007700">();<br />
public function </span><span style="color: #0000BB">send</span><span style="color: #007700">();<br />
public function </span><span style="color: #0000BB">recieve</span><span style="color: #007700">();<br />
}interface <span style="color: #0000BB">printer</span><span style="color: #007700">{<br />
public function </span><span style="color: #0000BB">printBlack</span><span style="color: #007700">();<br />
public function </span><span style="color: #0000BB">printColor</span><span style="color: #007700">();<br />
public function </span><span style="color: #0000BB">printDraft</span><span style="color: #007700">();<br />
public function </span><span style="color: #0000BB">kick</span><span style="color: #007700">();<br />
}class <span style="color: #0000BB">printerFax </span><span style="color: #007700">implements </span><span style="color: #0000BB">fax</span><span style="color: #007700">, </span><span style="color: #0000BB">printer</span><span style="color: #007700">{<br />
public function </span><span style="color: #0000BB">dial</span><span style="color: #007700">(){ }<br />
public function </span><span style="color: #0000BB">send</span><span style="color: #007700">(){ }<br />
public function </span><span style="color: #0000BB">recieve</span><span style="color: #007700">(){ }<br />
public function </span><span style="color: #0000BB">printBlack</span><span style="color: #007700">(){ }<br />
public function </span><span style="color: #0000BB">printColor</span><span style="color: #007700">(){ }<br />
public function </span><span style="color: #0000BB">printDraft</span><span style="color: #007700">(){ }<br />
public function </span><span style="color: #0000BB">kick</span><span style="color: #007700">(){ }<br />
}<span style="color: #0000BB">$object </span><span style="color: #007700">= new </span><span style="color: #0000BB">printerFax</span><span style="color: #007700">;<br />
</span><span style="color: #0000BB">?&gt;<br />
</span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></code></div>
<p>Before we go further, it is recommended you run the above code. It will produce no output but we need to be sure all is well. Having run the code, remove the line</p>
<p>public function kick(){ }</p>
<p>and run it again. What you should now get is an error such as:</p>
<p>Fatal error: Class printerFax contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (printer::kick) in /www/oop.php on line 22</p>
<p>With the kick() function removed from our implementation, we have essentially broken the contract that says we will implement every function (method) specified in the interface. We can gather these functions fractionally from multiple classes, but we MUST have them all or we will get errors such as the one above.</p>
<p>Interfaces play a major role in with <a href="http://www.phpro.org/tutorials/Introduction-to-SPL.html">SPL</a> and it is recommend you implement the interfaces from <a href="http://www.phpro.org/tutorials/Introduction-to-SPL.html">SPL</a> and not just the class methods.</p>
<h2><a class="anchor" name="11">PHP Class functions</a></h2>
<p>PHP has available several class functions to help you through the OOP mine field.</p>
<ul>
<li>get_declared_interfaces()</li>
<li>class_exists()</li>
<li>get_class()</li>
<li>get_declared_classes()</li>
</ul>
<p>Each of these is shown here beginning with the get_declared_interfaces().</p>
<h2><a class="anchor" name="11.1">get_declared_interfaces()</a></h2>
<p>This helper function provides an array of all the available declared interfaces.</p>
<div class="codebox"><code><span style="color: #000000"></p>
<p><span style="color: #0000BB">&lt;?php<br />
</span><span style="color: #007700">interface </span><span style="color: #0000BB">fax</span><span style="color: #007700">{<br />
public function </span><span style="color: #0000BB">dial</span><span style="color: #007700">();<br />
public function </span><span style="color: #0000BB">send</span><span style="color: #007700">();<br />
public function </span><span style="color: #0000BB">recieve</span><span style="color: #007700">();<br />
}interface <span style="color: #0000BB">printer</span><span style="color: #007700">{<br />
public function </span><span style="color: #0000BB">printBlack</span><span style="color: #007700">();<br />
public function </span><span style="color: #0000BB">printColor</span><span style="color: #007700">();<br />
public function </span><span style="color: #0000BB">printDraft</span><span style="color: #007700">();<br />
public function </span><span style="color: #0000BB">kick</span><span style="color: #007700">();<br />
}<span style="color: #FF8000">/*** our interface implementation ***/<br />
</span><span style="color: #007700">class </span><span style="color: #0000BB">printerFax </span><span style="color: #007700">implements </span><span style="color: #0000BB">fax</span><span style="color: #007700">, </span><span style="color: #0000BB">printer</span><span style="color: #007700">{<br />
public function </span><span style="color: #0000BB">dial</span><span style="color: #007700">(){ }<br />
public function </span><span style="color: #0000BB">send</span><span style="color: #007700">(){ }<br />
public function </span><span style="color: #0000BB">recieve</span><span style="color: #007700">(){ }<br />
public function </span><span style="color: #0000BB">printBlack</span><span style="color: #007700">(){ }<br />
public function </span><span style="color: #0000BB">printColor</span><span style="color: #007700">(){ }<br />
public function </span><span style="color: #0000BB">printDraft</span><span style="color: #007700">(){ }<br />
public function </span><span style="color: #0000BB">kick</span><span style="color: #007700">(){ }<br />
}<span style="color: #FF8000">/*** create and printerfax object ***/<br />
</span><span style="color: #0000BB">$object </span><span style="color: #007700">= new </span><span style="color: #0000BB">printerFax</span><span style="color: #007700">;<br />
</span><span style="color: #FF8000">/*** get the declared interfaces ***/<br />
</span><span style="color: #007700">foreach(</span><span style="color: #0000BB">get_declared_interfaces</span><span style="color: #007700">() as </span><span style="color: #0000BB">$key</span><span style="color: #007700">=&gt;</span><span style="color: #0000BB">$interface</span><span style="color: #007700">)<br />
{<br />
echo </span><span style="color: #0000BB">$key</span><span style="color: #007700">.</span><span style="color: #DD0000">&#8216; =&amp;gt; &#8217;</span><span style="color: #007700">.</span><span style="color: #0000BB">$interface</span><span style="color: #007700">.</span><span style="color: #DD0000">&#8216;&lt;br /&gt;&#8217;</span><span style="color: #007700">;<br />
}<br />
</span><span style="color: #0000BB">?&gt;<br />
</span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></code></div>
<p>The above code should produce a list such as this:</p>
<ul>
<li>0 =&gt; Traversable</li>
<li>1 =&gt; IteratorAggregate</li>
<li>2 =&gt; Iterator</li>
<li>3 =&gt; ArrayAccess</li>
<li>4 =&gt; Serializable</li>
<li>5 =&gt; RecursiveIterator</li>
<li>6 =&gt; OuterIterator</li>
<li>7 =&gt; SeekableIterator</li>
<li>8 =&gt; Countable</li>
<li>9 =&gt; SplObserver</li>
<li>10 =&gt; SplSubject</li>
<li>11 =&gt; Reflector</li>
<li>12 =&gt; fax</li>
<li>13 =&gt; printer</li>
</ul>
<p>From the list above you can see the <a href="http://www.phpro.org/tutorials/Introduction-to-SPL.html">SPL</a> interfaces available and at the bottom is our fax and printer interfaces. The printerfax is not listed as it is not an interface, rather it is an implentation of an interface.</p>
<h2><a class="anchor" name="11.2">Other functions</a></h2>
<p>Here we will see three helper functions for our classes</p>
<ul>
<li>get_class()</li>
<li>class_exists()</li>
<li>get_declared_classes</li>
</ul>
<div class="codebox"><code><span style="color: #000000"></p>
<p><span style="color: #0000BB">&lt;?php<br />
</span><span style="color: #FF8000">/*** a pretend class ***/<br />
</span><span style="color: #007700">class </span><span style="color: #0000BB">fax</span><span style="color: #007700">{<br />
public function </span><span style="color: #0000BB">dial</span><span style="color: #007700">(){ }<br />
public function </span><span style="color: #0000BB">send</span><span style="color: #007700">(){ }<br />
public function </span><span style="color: #0000BB">recieve</span><span style="color: #007700">(){ }<br />
}<span style="color: #FF8000">/*** another pretend class ***/<br />
</span><span style="color: #007700">class </span><span style="color: #0000BB">printer</span><span style="color: #007700">{<br />
public function </span><span style="color: #0000BB">printBlack</span><span style="color: #007700">(){ }<br />
public function </span><span style="color: #0000BB">printColor</span><span style="color: #007700">(){ }<br />
public function </span><span style="color: #0000BB">printDraft</span><span style="color: #007700">(){ }<br />
public function </span><span style="color: #0000BB">kick</span><span style="color: #007700">(){ }<br />
}<span style="color: #FF8000">/*** create an instance of the fax class ***/<br />
</span><span style="color: #0000BB">$foo </span><span style="color: #007700">= new </span><span style="color: #0000BB">fax</span><span style="color: #007700">;<span style="color: #FF8000">/*** create an instance of the printer class ***/<br />
</span><span style="color: #0000BB">$bar </span><span style="color: #007700">= new </span><span style="color: #0000BB">printer</span><span style="color: #007700">;echo <span style="color: #DD0000">&#8216;$foo is from the &#8217; </span><span style="color: #0000BB">get_class</span><span style="color: #007700">(</span><span style="color: #0000BB">$foo</span><span style="color: #007700">).</span><span style="color: #DD0000">&#8216; class&lt;br /&gt;&#8217;</span><span style="color: #007700">;<br />
echo </span><span style="color: #0000BB">class_exists</span><span style="color: #007700">(</span><span style="color: #DD0000">&#8220;printer&#8221;</span><span style="color: #007700">).</span><span style="color: #DD0000">&#8216;&lt;br /&gt;&#8217;</span><span style="color: #007700">;<br />
echo </span><span style="color: #DD0000">&#8216;Declared classes are:&lt;br /&gt; &#8217;</span><span style="color: #007700">;<br />
foreach(</span><span style="color: #0000BB">get_declared_classes</span><span style="color: #007700">() as </span><span style="color: #0000BB">$key</span><span style="color: #007700">=&gt;</span><span style="color: #0000BB">$classname</span><span style="color: #007700">)<br />
{<br />
echo </span><span style="color: #0000BB">$key</span><span style="color: #007700">.</span><span style="color: #DD0000">&#8216; -&amp;gt; &#8217;</span><span style="color: #007700">.</span><span style="color: #0000BB">$classname</span><span style="color: #007700">.</span><span style="color: #DD0000">&#8216;&lt;br /&gt;&#8217;</span><span style="color: #007700">;<br />
}<br />
</span><span style="color: #0000BB">?&gt;</span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></code></div>
<p>The little snippet above will produce over one hundred available classes, shortened here for the sake of sanity, such as these below. Note our fax and printer classes at the bottom of the list.</p>
<ul>
<li>$foo is from the fax class</li>
<li>1</li>
<li>0 -&gt; stdClass</li>
<li>1 -&gt; Exception</li>
<li> &#8212;8&lt;&#8212; snip &#8212;</li>
<li>106 -&gt; fax</li>
<li>107 -&gt; printer</li>
</ul>
<h2><a class="anchor" name="12">Autoload</a></h2>
<p>Earlier in this tutorial we stated that the class definition must be included in every call to an object. This is commonly achieved with the include() or require() functions such as below.</p>
<div class="codebox"><code><span style="color: #000000"></p>
<p><span style="color: #0000BB">&lt;?php<span style="color: #FF8000">/*** include our class definitions ***/<br />
</span><span style="color: #007700">include(</span><span style="color: #DD0000">&#8216;classes/vehicle.class.php&#8217;</span><span style="color: #007700">);include(<span style="color: #DD0000">&#8216;classes/motorcycle.class.php&#8217;</span><span style="color: #007700">);include(<span style="color: #DD0000">&#8216;classes/printer.class.php&#8217;</span><span style="color: #007700">);include(<span style="color: #DD0000">&#8216;classes/printer.class.php&#8217;</span><span style="color: #007700">);<span style="color: #FF8000">/*** instantiate a new vehicle class object ***/<br />
</span><span style="color: #0000BB">$vehicle </span><span style="color: #007700">= new </span><span style="color: #0000BB">vehicle</span><span style="color: #007700">;*** <span style="color: #0000BB">instantiate a </span><span style="color: #007700">new </span><span style="color: #0000BB">motorcycle </span><span style="color: #007700">class </span><span style="color: #0000BB">object </span><span style="color: #007700">***/<br />
</span><span style="color: #0000BB">$bike </span><span style="color: #007700">= new </span><span style="color: #0000BB">motorcycle</span><span style="color: #007700">;*** <span style="color: #0000BB">instantiate a </span><span style="color: #007700">new </span><span style="color: #0000BB">printer </span><span style="color: #007700">class </span><span style="color: #0000BB">object </span><span style="color: #007700">***/<br />
</span><span style="color: #0000BB">$printer </span><span style="color: #007700">= new </span><span style="color: #0000BB">printer</span><span style="color: #007700">;*** <span style="color: #0000BB">instantiate a </span><span style="color: #007700">new </span><span style="color: #0000BB">fax </span><span style="color: #007700">class </span><span style="color: #0000BB">object </span><span style="color: #007700">***/<br />
</span><span style="color: #0000BB">$fax </span><span style="color: #007700">= new </span><span style="color: #0000BB">fax</span><span style="color: #007700">;<span style="color: #0000BB">?&gt;<br />
</span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></code></div>
<p>As you can see, this is quite cumbersome. The solution to this sort of mess is __autoload(). The __autoload() function will internally search out the class and load its definition. So the above block of code could be reduced to this.</p>
<div class="codebox"><code><span style="color: #000000"></p>
<p><span style="color: #0000BB">&lt;?php<br />
</span><span style="color: #FF8000">/*** Autoload class files ***/<br />
</span><span style="color: #007700">function </span><span style="color: #0000BB">__autoload</span><span style="color: #007700">(</span><span style="color: #0000BB">$class</span><span style="color: #007700">){<br />
require(</span><span style="color: #DD0000">&#8216;classes/&#8217; </span><span style="color: #007700">. </span><span style="color: #0000BB">strtolower</span><span style="color: #007700">(</span><span style="color: #0000BB">$class</span><span style="color: #007700">) . </span><span style="color: #DD0000">&#8216;.class.php&#8217;</span><span style="color: #007700">);<br />
}<span style="color: #FF8000">/*** instantiate a new vehicle class object ***/<br />
</span><span style="color: #0000BB">$vehicle </span><span style="color: #007700">= new </span><span style="color: #0000BB">vehicle</span><span style="color: #007700">;<span style="color: #FF8000">/*** instantiate a new motorcycle class object ***/<br />
</span><span style="color: #0000BB">$bike </span><span style="color: #007700">= new </span><span style="color: #0000BB">motorcycle</span><span style="color: #007700">;<span style="color: #FF8000">/*** instantiate a new printer class object ***/<br />
</span><span style="color: #0000BB">$printer </span><span style="color: #007700">= new </span><span style="color: #0000BB">printer</span><span style="color: #007700">;<span style="color: #FF8000">/*** instantiate a new fax class object ***/<br />
</span><span style="color: #0000BB">$fax </span><span style="color: #007700">= new </span><span style="color: #0000BB">fax</span><span style="color: #007700">;<span style="color: #0000BB">?&gt;<br />
</span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></code></div>
<p>Now we can load up as many class definitions as we like because they will be autoloaded when we try to use a class that has not been defined. This can save much coding and much searching for code. It is important to remember the naming convention of your classes and class files. Each class file should be named the same as the class definition itself. eg: a class definition file named fax would have the filename fax.class.php</p>
<p>The use of the strtolower() function assures compatibility of naming conventions as windows machines fail to be case sensitive for filenames.</p>
<h2><a class="anchor" name="13">Serializing Objects</a></h2>
<p>We have seen a lot of code above for the use of objects and how they can save us time (and $$$) by re-using them. But what if we needed to somehow store an object for later retrieval, perhaps in a database or in a session variable? PHP has given us the serialize() function to make this rather effortless. There are some limitations, but this can be a very useful tool for applications. Lets see how it performs with a little code.</p>
<div class="codebox"><code><span style="color: #000000"></p>
<p><span style="color: #0000BB">&lt;?php<br />
</span><span style="color: #FF8000">/*** code here ***/<br />
</span><span style="color: #0000BB">?&gt;<br />
</span></p>
<p></span></code></div>
<h2><a class="anchor" name="14">Overloading</a></h2>
<p>Comes a time in every programmers life when&#8230;hmm</p>
<p>Overloading in PHP has caused much confusion for no real reason. PHP Overloading can be broken downinto two basic components</p>
<ul>
<li>Method overloading</li>
<li>Property overloading</li>
</ul>
<p>Simply put, Method Overloading is achieved by a special function named <span class="codechar">__call()</span>. It is available as a sort of method wildcard for calls to undefined methods within a class. This special function is only called when the original method name does not exist. The <span class="codechar">__call()</span> will only work when the class method you are trying to access does not exist. Lets take it for a spin..</p>
<div class="codebox"><code><span style="color: #000000"></p>
<p><span style="color: #0000BB">&lt;?php<br />
</span><span style="color: #007700">class </span><span style="color: #0000BB">my_class</span><span style="color: #007700">{<br />
public function </span><span style="color: #0000BB">foo</span><span style="color: #007700">() {<br />
return </span><span style="color: #DD0000">&#8220;This is the foo function&#8221;</span><span style="color: #007700">;<br />
}} <span style="color: #FF8000">/*** end of class ***//*** create a new class object ***/<br />
<span style="color: #0000BB">$obj </span><span style="color: #007700">= new </span><span style="color: #0000BB">my_class</span><span style="color: #007700">;<br />
</span><span style="color: #FF8000">/*** call a non-existant method ***/<br />
</span><span style="color: #0000BB">$obj</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">bar</span><span style="color: #007700">();<br />
</span><span style="color: #0000BB">?&gt;<br />
</span></p>
<p></span></p>
<p></span></p>
<p></span></code></div>
<p>Of course the above snippet of code will produce an error such as</p>
<p>Fatal error: Call to undefined method my_class::bar() in /www/overload.php on line 12</p>
<p>because we have called the bar() class method that does not exist. Enter __call(). With the __call() function in place, PHP will try to create the function and you have any code within the _call() method that you like. The __call() method takes two arguements, the method name, and the arguements. Your call to the undefined method may have many arguements and these are returned in an array. Lets put it to the test with two args.</p>
<div class="codebox"><code><span style="color: #000000"></p>
<p><span style="color: #0000BB">&lt;?php<br />
</span><span style="color: #007700">class </span><span style="color: #0000BB">my_class</span><span style="color: #007700">{<br />
public function </span><span style="color: #0000BB">foo</span><span style="color: #007700">() {<br />
return </span><span style="color: #DD0000">&#8220;This is the foo function&#8221;</span><span style="color: #007700">;<br />
}<br />
</span><span style="color: #FF8000">/*** __call() method with two args ***/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">__call</span><span style="color: #007700">(</span><span style="color: #0000BB">$method</span><span style="color: #007700">, </span><span style="color: #0000BB">$arg</span><span style="color: #007700">){<br />
echo </span><span style="color: #0000BB">$method</span><span style="color: #007700">.</span><span style="color: #DD0000">&#8216;&lt;br /&gt;&#8217;</span><span style="color: #007700">;<br />
</span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$arg</span><span style="color: #007700">);<br />
}<br />
} </span><span style="color: #FF8000">/*** end of class ***//*** create a new class object ***/<br />
<span style="color: #0000BB">$obj </span><span style="color: #007700">= new </span><span style="color: #0000BB">my_class</span><span style="color: #007700">;<br />
</span><span style="color: #FF8000">/*** call a non-existant method ***/<br />
</span><span style="color: #0000BB">$obj</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">bar</span><span style="color: #007700">(</span><span style="color: #DD0000">&#8220;arg1&#8243;</span><span style="color: #007700">, </span><span style="color: #DD0000">&#8220;arg2&#8243;</span><span style="color: #007700">);<br />
</span><span style="color: #0000BB">?&gt;<br />
</span></p>
<p></span></p>
<p></span></code></div>
<p>The above code will print the following</p>
<p>bar</p>
<p>Array ( [0] =&gt; arg1 [1] =&gt; arg2 )</p>
<p>The __call() method has returned the method name that we called along with the array of args passed to it.</p>
<p>Lets now look at we can dynimically manipulate or overload our data.</p>
<div class="codebox"><code><span style="color: #000000"></p>
<p><span style="color: #0000BB">&lt;?php<br />
</span><span style="color: #007700">class </span><span style="color: #0000BB">readyGetSet </span><span style="color: #007700">{<br />
</span><span style="color: #FF8000">/*** declare $item ***/<br />
</span><span style="color: #007700">private </span><span style="color: #0000BB">$item </span><span style="color: #007700">= </span><span style="color: #DD0000">&#8216;Skate Board&#8217;</span><span style="color: #007700">;<br />
</span><span style="color: #FF8000">/*** declare the price ***/<br />
</span><span style="color: #007700">private </span><span style="color: #0000BB">$price </span><span style="color: #007700">= </span><span style="color: #0000BB">100</span><span style="color: #007700">;<span style="color: #FF8000">/*** our call function ***/<br />
</span><span style="color: #007700">function </span><span style="color: #0000BB">__call</span><span style="color: #007700">(</span><span style="color: #0000BB">$method</span><span style="color: #007700">, </span><span style="color: #0000BB">$arguments</span><span style="color: #007700">){<br />
</span><span style="color: #FF8000">/*** set property and prefix ***/<br />
</span><span style="color: #0000BB">$prefix </span><span style="color: #007700">= </span><span style="color: #0000BB">strtolower</span><span style="color: #007700">(</span><span style="color: #0000BB">substr</span><span style="color: #007700">(</span><span style="color: #0000BB">$method</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">3</span><span style="color: #007700">));<br />
</span><span style="color: #0000BB">$property </span><span style="color: #007700">= </span><span style="color: #0000BB">strtolower</span><span style="color: #007700">(</span><span style="color: #0000BB">substr</span><span style="color: #007700">(</span><span style="color: #0000BB">$method</span><span style="color: #007700">, </span><span style="color: #0000BB">3</span><span style="color: #007700">));if (empty(<span style="color: #0000BB">$prefix</span><span style="color: #007700">) || empty(</span><span style="color: #0000BB">$property</span><span style="color: #007700">))<br />
{<br />
return;<br />
}if (<span style="color: #0000BB">$prefix </span><span style="color: #007700">== </span><span style="color: #DD0000">&#8216;get&#8217; </span><span style="color: #007700">&amp;&amp; isset(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">$property</span><span style="color: #007700">))<br />
{<br />
return </span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">$property</span><span style="color: #007700">;<br />
}if (<span style="color: #0000BB">$prefix </span><span style="color: #007700">== </span><span style="color: #DD0000">&#8217;set&#8217;</span><span style="color: #007700">)<br />
{<br />
</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">$property </span><span style="color: #007700">= </span><span style="color: #0000BB">$arguments</span><span style="color: #007700">[</span><span style="color: #0000BB">0</span><span style="color: #007700">];<br />
}<br />
}<br />
}<span style="color: #0000BB">$obj </span><span style="color: #007700">= new </span><span style="color: #0000BB">readyGetSet</span><span style="color: #007700">;echo <span style="color: #DD0000">&#8216;Item: &#8217; </span><span style="color: #007700">. </span><span style="color: #0000BB">$obj</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getItem</span><span style="color: #007700">() . </span><span style="color: #DD0000">&#8216;&lt;br /&gt;&#8217;</span><span style="color: #007700">;<br />
echo </span><span style="color: #DD0000">&#8216;Price: &#8217; </span><span style="color: #007700">. </span><span style="color: #0000BB">$obj</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getPrice</span><span style="color: #007700">() . </span><span style="color: #DD0000">&#8216;&lt;br /&gt;&#8217;</span><span style="color: #007700">;<span style="color: #0000BB">$obj</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setItem</span><span style="color: #007700">(</span><span style="color: #DD0000">&#8216;CD&#8217;</span><span style="color: #007700">);<br />
</span><span style="color: #0000BB">$obj</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setPrice</span><span style="color: #007700">(</span><span style="color: #0000BB">25</span><span style="color: #007700">);echo <span style="color: #DD0000">&#8216;Item: &#8217; </span><span style="color: #007700">. </span><span style="color: #0000BB">$obj</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getItem</span><span style="color: #007700">() . </span><span style="color: #DD0000">&#8216;&lt;br /&gt;&#8217;</span><span style="color: #007700">;<br />
echo </span><span style="color: #DD0000">&#8216;Price: &#8217; </span><span style="color: #007700">. </span><span style="color: #0000BB">$obj</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getPrice</span><span style="color: #007700">() . </span><span style="color: #DD0000">&#8216;&lt;br /&gt;&#8217;</span><span style="color: #007700">;<br />
</span><span style="color: #0000BB">?&gt;<br />
</span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></code></div>
<p>The second part of overloading refers to properties and the ability to be able to dynamically get and set object properties. The <span class="codechar">__get()</span> function is called when reading the value of an undefined property, and <span class="codechar">__set()</span> is called when trying to change that properties value. I hope this is clear as it can get a little confusing&#8230; Lets see how it works by example.</p>
<div class="codebox"><code><span style="color: #000000"></p>
<p><span style="color: #0000BB">&lt;?php<span style="color: #007700">class </span><span style="color: #0000BB">candy</span><span style="color: #007700">{<br />
</span><span style="color: #FF8000">/*** declare a property ***/<br />
</span><span style="color: #007700">public </span><span style="color: #0000BB">$type</span><span style="color: #007700">=</span><span style="color: #DD0000">&#8216;chocolate&#8217;</span><span style="color: #007700">;<span style="color: #FF8000">/*** a normal method ***/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">wrap</span><span style="color: #007700">(){<br />
echo </span><span style="color: #DD0000">&#8216;Its a wrap&#8217;</span><span style="color: #007700">;<br />
}<br />
</span><span style="color: #FF8000">/*** our __set() function ***/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">__set</span><span style="color: #007700">(</span><span style="color: #0000BB">$index</span><span style="color: #007700">, </span><span style="color: #0000BB">$value</span><span style="color: #007700">){<br />
echo </span><span style="color: #DD0000">&#8216;The value of &#8217;</span><span style="color: #007700">.</span><span style="color: #0000BB">$index</span><span style="color: #007700">.</span><span style="color: #DD0000">&#8216; is &#8217;</span><span style="color: #007700">.</span><span style="color: #0000BB">$value</span><span style="color: #007700">;<br />
}} <span style="color: #FF8000">/*** end of class ***//*** a new candy object ***/<br />
<span style="color: #0000BB">$candy </span><span style="color: #007700">= new </span><span style="color: #0000BB">candy</span><span style="color: #007700">;<br />
</span><span style="color: #FF8000">/*** set a non existant property ***/<br />
</span><span style="color: #0000BB">$candy</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">bar </span><span style="color: #007700">= </span><span style="color: #DD0000">&#8216;Blue Smarties&#8217;</span><span style="color: #007700">;<span style="color: #0000BB">?&gt;<br />
</span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></code></div>
<p>The result from above will be:</p>
<p>The value of bar is Blue Smarties</p>
<p>Lets see what we have done. We have described a class named candy which contains a public property named $type. It has a simple method and our __set() method. After the class our user code creates a new instance of the candy class. Then we try to set a variable that does not exist in the class. Here the __set method takes control and assigns it for us. We then see in our __set method that it echoes the name of the variable, plus its intended value. The __set() method takes two arguements, the name of the non existant variable, and its intended value.</p>
<p>The <span class="codechare">__get()</span> method &#8230;.</p>
<div class="codebox"><code><span style="color: #000000"></p>
<p><span style="color: #0000BB">&lt;?php<span style="color: #007700">class </span><span style="color: #0000BB">candy</span><span style="color: #007700">{<br />
</span><span style="color: #FF8000">/*** declare a property ***/<br />
</span><span style="color: #007700">public </span><span style="color: #0000BB">$type</span><span style="color: #007700">=</span><span style="color: #DD0000">&#8216;chocolate&#8217;</span><span style="color: #007700">;public <span style="color: #0000BB">$choctype </span><span style="color: #007700">= array(</span><span style="color: #DD0000">&#8216;milk&#8217;</span><span style="color: #007700">=&gt;</span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #DD0000">&#8216;dark&#8217;</span><span style="color: #007700">=&gt;</span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #DD0000">&#8216;plain&#8217;</span><span style="color: #007700">=&gt;</span><span style="color: #0000BB">2</span><span style="color: #007700">);<span style="color: #FF8000">/*** a normal method ***/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">wrap</span><span style="color: #007700">(){<br />
echo </span><span style="color: #DD0000">&#8216;Its a wrap&#8217;</span><span style="color: #007700">;<br />
}<br />
</span><span style="color: #FF8000">/*** our __set() function ***/<br />
</span><span style="color: #007700">public function </span><span style="color: #0000BB">__get</span><span style="color: #007700">(</span><span style="color: #0000BB">$index</span><span style="color: #007700">){<br />
echo </span><span style="color: #DD0000">&#8216;Retrieving element of $choctype property with index of &#8217;</span><span style="color: #007700">.</span><span style="color: #0000BB">$index</span><span style="color: #007700">.</span><span style="color: #DD0000">&#8216;&lt;br /&gt;&#8217;</span><span style="color: #007700">;<br />
return </span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">choctype</span><span style="color: #007700">[</span><span style="color: #0000BB">$index</span><span style="color: #007700">];<br />
}} <span style="color: #FF8000">/*** end of class ***//*** a new candy object ***/<br />
<span style="color: #0000BB">$candy </span><span style="color: #007700">= new </span><span style="color: #0000BB">candy</span><span style="color: #007700">;<br />
</span><span style="color: #FF8000">/*** set a non existant property ***/<br />
</span><span style="color: #007700">echo </span><span style="color: #DD0000">&#8216;The value of the following element property is &#8217;</span><span style="color: #007700">.</span><span style="color: #0000BB">$candy</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">milk</span><span style="color: #007700">;<span style="color: #0000BB">?&gt;<br />
</span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></code></div>
<p>From the above code we get the result</p>
<p>Retrieving element of $choctype property with index of milk</p>
<p>The value of the following element property is 0</p>
<h2><a class="anchor" name="12">Class Constants</a></h2>
<p>You have more than likely seen the use standard constants in PHP. To define a standard constant we use this code:</p>
<div class="codebox"><code><span style="color: #000000"></p>
<p>/*** define an error message ***/<br />
define(&#8217;_ERROR_MSG&#8217;, &#8217;An Error has occured!&#8217;);<br />
/*** echo the constant ***/<br />
echo _ERROR_MSG;<br />
?&gt;</p>
<p></span></code></div>
<p>The above snippit would output</p>
<p>An Error has occured!</p>
<p>To define a class constant we use the <span class="codechar">const</span> keyword.</p>
<div class="codebox"><code><span style="color: #000000"></p>
<p><span style="color: #0000BB">&lt;?php<span style="color: #007700">class </span><span style="color: #0000BB">my_class </span><span style="color: #007700">{<br />
</span><span style="color: #FF8000">/*** define a class constant ***/<br />
</span><span style="color: #007700">const </span><span style="color: #0000BB">_ERROR_MSG </span><span style="color: #007700">= </span><span style="color: #DD0000">&#8216;An Error has occured!&#8217;</span><span style="color: #007700">;public function <span style="color: #0000BB">show</span><span style="color: #007700">(){<br />
echo </span><span style="color: #0000BB">self</span><span style="color: #007700">::</span><span style="color: #0000BB">_ERROR_MSG</span><span style="color: #007700">;<br />
}} <span style="color: #FF8000">/*** end of class ***/<br />
</span><span style="color: #0000BB">?&gt;<br />
</span></p>
<p></span></p>
<p></span></p>
<p></span></p>
<p></span></code></div>
<p>There are now three ways the class constant can be access from this example.</p>
<div class="codebox"><code><span style="color: #000000"><br />
<span style="color: #0000BB">&lt;?php<br />
</span><span style="color: #FF8000">/*** static call to constant ***/<br />
</span><span style="color: #007700">echo </span><span style="color: #0000BB">my_class</span><span style="color: #007700">::</span><span style="color: #0000BB">_ERROR_MSG</span><span style="color: #007700">;<br />
</span><span style="color: #FF8000">/*** instantiate a class object ***/<br />
</span><span style="color: #0000BB">$my_class </span><span style="color: #007700">= new </span><span style="color: #0000BB">my_class</span><span style="color: #007700">;<br />
</span><span style="color: #FF8000">/*** can run the show() method ***/<br />
</span><span style="color: #0000BB">$my_class</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">show</span><span style="color: #007700">();<br />
</span><span style="color: #FF8000">/*** static call to the show method() ***/<br />
</span><span style="color: #0000BB">my_class</span><span style="color: #007700">::</span><span style="color: #0000BB">show</span><span style="color: #007700">();<br />
</span><span style="color: #0000BB">?&gt;<br />
</span><br />
</span><br />
</code></div>
<p>Each of the above methods would output the same line</p>
<p>An Error has occured!</p>
<p>A class constant, like standard constants, must be exactly as the name suggests, a constant value. It cannot be a variable or the result of a function or method.</p>
<h2><a class="anchor" name="77">Credits</a></h2>
<p>The Original Post can found here: <a href="http://www.phpro.org/tutorials/Object-Oriented-Programming-with-PHP.html" target="_blank">http://www.phpro.org/tutorials/Object-Oriented-Programming-with-PHP.html</a></p>
<p>This concludes our little insight into PHP OOP. If you have anything you would like to see here just <a href="http://www.phpro.org/contact/">contact us</a> and we will do our best to help.<br />
<h3>View Also</h3>
<ul class="related_post">
<li><a href="http://www.jagadishwor.com.np/2009/07/optimizing-png-for-the-web/" title="Optimizing PNG for the web">Optimizing PNG for the web</a></li>
<li><a href="http://www.jagadishwor.com.np/2009/01/php-send-email-with-an-attachment/" title="PHP send email with an attachment">PHP send email with an attachment</a></li>
<li><a href="http://www.jagadishwor.com.np/2008/05/what-is-ajax/" title="What is Ajax?">What is Ajax?</a></li>
<li><a href="http://www.jagadishwor.com.np/2009/01/php-find-the-visitors-details/" title="PHP find the visitors details">PHP find the visitors details</a></li>
<li><a href="http://www.jagadishwor.com.np/2010/02/php-array-functions/" title="PHP Array Functions">PHP Array Functions</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.jagadishwor.com.np/2010/01/object-oriented-programming-with-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>10 Simple PHP Login Sytem Tutorial</title>
		<link>http://www.jagadishwor.com.np/2009/12/10-simple-php-login-sytem-tutorial/</link>
		<comments>http://www.jagadishwor.com.np/2009/12/10-simple-php-login-sytem-tutorial/#comments</comments>
		<pubDate>Thu, 31 Dec 2009 08:06:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.jagadishwor.com.np/?p=255</guid>
		<description><![CDATA[Login System is the First Part of Security system in web programming. In this tutorial I am going to show you the collection of various methos and types of login system. I will give a right choice for your system and you can understand more about login.
1. Making A Cool Login System With PHP, MySQL [...]]]></description>
			<content:encoded><![CDATA[<p>Login System is the First Part of Security system in web programming. In this tutorial I am going to show you the collection of various methos and types of login system. I will give a right choice for your system and you can understand more about login.</p>
<p><strong>1. <a href="http://tutorialzine.com/2009/10/cool-login-system-php-jquery/" target="_blank">Making A Cool Login System With PHP, MySQL &amp; jQuery</a></strong></p>
<p><strong><a href="http://tutorialzine.com/2009/10/cool-login-system-php-jquery/" target="_blank"><img src="http://www.jagadishwor.com.np//wp-content/uploads/2009/12/loginmain.gif" border="0" alt="" width="500" height="286" /></a></strong></p>
<p><strong>2. <a href="http://roshanbh.com.np/2008/04/ajax-login-validation-php-jquery.html" target="_blank">Ajax login validation system in PHP using jQuery</a></strong></p>
<p><strong><a href="http://roshanbh.com.np/2008/04/ajax-login-validation-php-jquery.html" target="_blank"><img src="http://www.jagadishwor.com.np//wp-content/uploads/2009/12/roshan.gif" border="0" alt="" width="500" height="79" /></a></strong></p>
<p><strong>3. <a href="http://www.evolt.org/node/60384" target="_blank">PHP Login System with Admin Features By evolt org </a></strong></p>
<p><strong></strong></p>
<p><strong>4. <a href="http://www.phpcollection.com/php-login-system-login-management-and-login-control-tutorial.html" target="_blank">Php Login System – Login Management and Login Control Tutorial</a></strong></p>
<p><strong><a href="http://www.phpcollection.com/php-login-system-login-management-and-login-control-tutorial.html" target="_blank"><img src="http://www.jagadishwor.com.np//wp-content/uploads/2009/12/phpcollection.gif" border="0" alt="" width="500" height="76" /></a></strong></p>
<p><strong>5. <a href="http://www.howtodothings.com/computers-internet/how-to-make-a-login-system-for-your-website" target="_blank">How To Make a Login System for Your Website</a></strong></p>
<p><strong><a href="http://www.howtodothings.com/computers-internet/how-to-make-a-login-system-for-your-website" target="_blank"><img src="http://www.jagadishwor.com.np//wp-content/uploads/2009/12/howtodo.gif" border="0" alt="" width="500" height="87" /></a></strong></p>
<p><strong>6. <a href="http://www.ineedtutorials.com/code/php/complete-advanced-login-member-system-php-tutorial" target="_blank">Complete advanced login member system – PHP tutorial</a></strong></p>
<p><strong><a href="http://www.ineedtutorials.com/code/php/complete-advanced-login-member-system-php-tutorial" target="_blank"><img src="http://www.jagadishwor.com.np//wp-content/uploads/2009/12/indeed.gif" border="0" alt="" width="500" height="94" /></a></strong></p>
<p><strong>7. <a href="http://php.about.com/od/finishedphp1/ss/php_login_code.htm" target="_blank">PHP Login Script</a></strong></p>
<p><a href="http://php.about.com/od/finishedphp1/ss/php_login_code.htm" target="_blank"><img src="http://www.jagadishwor.com.np//wp-content/uploads/2009/12/about.gif" border="0" alt="" width="500" height="90" /></a></p>
<p><strong>8. <a href="http://net.tutsplus.com/tutorials/php/a-better-login-system/" target="_blank">A Better Login System</a></strong></p>
<p><a href="http://net.tutsplus.com/tutorials/php/a-better-login-system/" target="_blank"><img src="http://www.jagadishwor.com.np//wp-content/uploads/2009/12/nettus.gif" border="0" alt="" width="500" height="96" /></a></p>
<p><strong>9. <a href="http://www.phpeasystep.com/workshopview.php?id=6" target="_blank">PHP Login script tutorial</a></strong></p>
<p><a href="http://www.phpeasystep.com/workshopview.php?id=6" target="_blank"><img src="http://www.jagadishwor.com.np//wp-content/uploads/2009/12/easystep.gif" border="0" alt="" width="500" height="81" /></a></p>
<p><strong>10. <a href="http://www.phpbuilder.com/columns/tim20000505.php3" target="_blank">A Complete, Secure User Login System</a></strong></p>
<p><a href="http://www.phpbuilder.com/columns/tim20000505.php3" target="_blank"><img src="http://www.jagadishwor.com.np//wp-content/uploads/2009/12/phpbuilder.gif" border="0" alt="" width="500" height="81" /></a><br />
<h3>Related Articles</h3>
<ul class="related_post">
<li><a href="http://www.jagadishwor.com.np/2010/02/php-array-functions/" title="PHP Array Functions">PHP Array Functions</a></li>
<li><a href="http://www.jagadishwor.com.np/2009/12/css-style-for-cms-system/" title="CSS style for CMS system">CSS style for CMS system</a></li>
<li><a href="http://www.jagadishwor.com.np/2009/11/php-mysql-own-cms-system-tutorial/" title="PHP Mysql own CMS system Tutorial">PHP Mysql own CMS system Tutorial</a></li>
<li><a href="http://www.jagadishwor.com.np/2009/10/php-image-file-upload-tutorial/" title="PHP Image File Upload Tutorial">PHP Image File Upload Tutorial</a></li>
<li><a href="http://www.jagadishwor.com.np/2009/09/php-simple-session-tutorial/" title="PHP Simple Session Tutorial">PHP Simple Session Tutorial</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.jagadishwor.com.np/2009/12/10-simple-php-login-sytem-tutorial/feed/</wfw:commentRss>
		</item>
		<item>
		<title>15 Free Joomla Template Sites</title>
		<link>http://www.jagadishwor.com.np/2009/12/15-free-joomla-template-sites/</link>
		<comments>http://www.jagadishwor.com.np/2009/12/15-free-joomla-template-sites/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 07:54:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Templates]]></category>

		<category><![CDATA[Joomla Templates]]></category>

		<guid isPermaLink="false">http://www.jagadishwor.com.np/?p=253</guid>
		<description><![CDATA[1. Joomla24 

2. Free Joomla Templates

3. Site Ground

4. Themza 

5. Free Joomla Templates

6. Template Monster

7. Joomla Mania

8. JoomlaShack

9. JoomlaDesigns

10. dezinedepot

11. Joomla Shine

12. Best Free Joomla Templates

13. Themebase

14. Best of Joomla

15. Joomla Xtreme 

View Also

Applying CSS Style in your web page.
Auto-populating Select Boxes using jQuery &#038; AJAX 
Select All and Deselect All checkbox Using Toggle Button
How [...]]]></description>
			<content:encoded><![CDATA[<p><strong>1. Joomla24 </strong></p>
<p><a href="http://www.joomla24.com/" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2009/12/joomla24.gif" border="0" alt="" width="500" height="317" /></a></p>
<p><strong>2. Free Joomla Templates</strong></p>
<p><a href="http://joomlatp.com/" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2009/12/freejoomla.gif" border="0" alt="" width="500" height="327" /></a></p>
<p><strong>3. Site Ground</strong></p>
<p><strong><a href="http://www.siteground.com/" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2009/12/siteground.gif" border="0" alt="" width="500" height="303" /></a></strong></p>
<p><strong>4. Themza </strong></p>
<p><img src="http://www.jagadishwor.com.np/wp-content/uploads/2009/12/themza.gif" alt="" width="500" height="367" /></p>
<p><strong>5. Free Joomla Templates</strong></p>
<p><strong><a href="http://joomla2u.net/" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2009/12/freejoomlatemp.gif" border="0" alt="" width="500" height="279" /></a></strong></p>
<p><strong>6. Template Monster</strong></p>
<p><strong><a href="http://www.templatemonster.com/free-joomla-templates.html" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2009/12/monster.gif" border="0" alt="" width="500" height="100" /></a></strong></p>
<p><strong>7. Joomla Mania</strong></p>
<p><a href="http://www.joomla-mania.com/" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2009/12/joomlamania.gif" border="0" alt="" width="500" height="67" /></a></p>
<p><strong>8. JoomlaShack</strong></p>
<p><a href="http://www.joomlashack.com/free-joomla-templates" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2009/12/joomlashack.gif" border="0" alt="" width="500" height="248" /></a></p>
<p><strong>9. JoomlaDesigns</strong></p>
<p><a href="http://www.joomladesigns.co.uk/templates/Free-Joomla-Templates.html" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2009/12/joomladesigns.gif" border="0" alt="" width="500" height="55" /></a></p>
<p><strong>10. dezinedepot</strong></p>
<p><a href="http://www.dezinedepot.com/joomla/free-joomla-templates" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2009/12/dejin.gif" border="0" alt="" width="500" height="304" /></a></p>
<p><strong>11. Joomla Shine</strong></p>
<p><a href="http://www.joomlashine.com/" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2009/12/joomlashine.gif" border="0" alt="" width="500" height="433" /></a></p>
<p><strong>12. Best Free Joomla Templates</strong></p>
<p><a href="http://www.bestfreejoomlatemplates.com/" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2009/12/joomlabest.gif" border="0" alt="" width="500" height="111" /></a></p>
<p><strong>13. Themebase</strong></p>
<p><a href="http://www.themesbase.com/?category=Joomla" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2009/12/themebase.gif" border="0" alt="" width="500" height="85" /></a></p>
<p><strong>14. Best of Joomla</strong></p>
<p><a href="http://www.bestofjoomla.com/" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2009/12/bestofjoomla.gif" border="0" alt="" width="500" height="187" /></a></p>
<p><strong>15. Joomla Xtreme </strong></p>
<p><a href="http://www.joomlaxtreme.com/free-joomla-templates-download" target="_blank"><img src="http://www.jagadishwor.com.np/wp-content/uploads/2009/12/joomlaxtreme.gif" border="0" alt="" width="500" height="74" /></a><br />
<h3>View Also</h3>
<ul class="related_post">
<li><a href="http://www.jagadishwor.com.np/2008/06/css-gradient-text-style/" title="CSS Gradient Text Style">CSS Gradient Text Style</a></li>
<li><a href="http://www.jagadishwor.com.np/2008/10/show-hide-div-by-single-button-using-jquery/" title="Show Hide Div by single button using Jquery">Show Hide Div by single button using Jquery</a></li>
<li><a href="http://www.jagadishwor.com.np/2009/10/simple-mysql-query-to-create-archieve-for-your-blog-post/" title="Simple MYSQL query to create Archieve for your blog post">Simple MYSQL query to create Archieve for your blog post</a></li>
<li><a href="http://www.jagadishwor.com.np/2009/09/jquery-addclass-removeclass-toggleclass-tutorial/" title="jQuery addClass(), removeClass(), toggleClass() Tutorial">jQuery addClass(), removeClass(), toggleClass() Tutorial</a></li>
<li><a href="http://www.jagadishwor.com.np/2008/09/human-varification-using-captcha-image/" title="Human Varification Using Captcha image">Human Varification Using Captcha image</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.jagadishwor.com.np/2009/12/15-free-joomla-template-sites/feed/</wfw:commentRss>
		</item>
		<item>
		<title>CodeIgniter tutorial for beginners</title>
		<link>http://www.jagadishwor.com.np/2009/12/codeigniter-tutorial-for-beginners/</link>
		<comments>http://www.jagadishwor.com.np/2009/12/codeigniter-tutorial-for-beginners/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 14:57:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Framework]]></category>

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

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

		<guid isPermaLink="false">http://www.jagadishwor.com.np/?p=249</guid>
		<description><![CDATA[&#8220;CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. If you&#8217;re a developer who lives in the real world of shared hosting accounts and clients with deadlines, and if you&#8217;re tired of ponderously large and thoroughly undocumented [...]]]></description>
			<content:encoded><![CDATA[<p><em>&#8220;CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. If you&#8217;re a developer who lives in the real world of shared hosting accounts and clients with deadlines, and if you&#8217;re tired of ponderously large and thoroughly undocumented frameworks&#8221;</em></p>
<p><strong>CodeIgniter is an open source web application framework for use in building dynamic web sites with PHP.</strong><em> </em></p>
<p><em><img src="http://www.jagadishwor.com.np/wp-content/uploads/2009/12/ci_banner.gif" alt="" width="500" height="194" /></em></p>
<p><strong>1. Download And Install CodeIgniter in your local system:</strong></p>
<p><img usemap="#Map" src="http://www.jagadishwor.com.np/wp-content/uploads/2009/12/ci_download.gif" border="0" alt="" width="290" height="245" /></p>
<p>a. Download the latest Version of CodeIgniter and Unzip it  in your root.</p>
<p>b. Move your folder to  your www folder. (I am using xampp so I move it in my xampp root.)</p>
<p>c. To check out your CodeIgniter just type: http://localhost/CodeIgniter_1.7.2/</p>
<p>d. You can rename your CodeIgniter as your application Like if I am going to create a blog I will rename CodeIgniter_1.7.2 to blog.</p>
<p>e.<br />
In your system/application/config directory you can change base url like :<br />
<code>$config['base_url']	= &#8220;http://localhost/blog/&#8221;;<br />
</code></p>
<p>f. To work with database open databse.php file from system/application/config/ and chage to your settings.</p>
<p><code>$db['default']['hostname'] = &#8220;localhost&#8221;;$db['default']['username'] = &#8220;root&#8221;;</p>
<p>$db['default']['password'] = &#8220;jagadish&#8221;;</p>
<p>$db['default']['database'] = &#8220;blog&#8221;;</p>
<p>$db['default']['dbdriver'] = &#8220;mysql&#8221;;</p>
<p>$db['default']['dbprefix'] = &#8220;&#8221;;</p>
<p>$db['default']['pconnect'] = TRUE;</p>
<p>$db['default']['db_debug'] = TRUE;</p>
<p>$db['default']['cache_on'] = FALSE;</p>
<p>$db['default']['cachedir'] = &#8220;&#8221;;</p>
<p>$db['default']['char_set'] = &#8220;utf8&#8243;;</p>
<p>$db['default']['dbcollat'] = &#8220;utf8_general_ci&#8221;;</p>
<p></code></p>
<p>Now Test your Blog http://localhost/blog/ You will see the below screen if your system have problem..</p>
<p><img src="http://www.jagadishwor.com.np/wp-content/uploads/2009/12/welcome.gif" alt="" width="500" height="233" /></p>
<p><strong>2.Understanding MCV:</strong></p>
<p>MVC is stands for Model View Controllers.</p>
<p><strong>MODEL</strong></p>
<p><dfn>Models are PHP classes that are designed to work with information in your database.</dfn></p>
<p>The <strong>Model</strong> represents your data structures. Typically your model classes will contain functions that help you retrieve, insert, and update information in your database.</p>
<p><strong>VIEW</strong></p>
<p>A <dfn>view</dfn> is simply a web page, or a page fragment, like a header, footer, sidebar, etc. In fact, views can flexibly be embedded within other views (within other views, etc., etc.) if you need this type of hierarchy. Views are never called directly. So in the above screen you can see there is a controller page welcome.php in system/application/controllers/welcome.php.</p>
<p><strong>CONTROLLER</strong></p>
<p><dfn>&#8220;A Controller is simply a class file that is named in a way that can be associated with a URI.&#8221;</dfn> You have to understand that when a controller&#8217;s name  matches the first segment of a URI, it will be loaded.</p>
<p><strong>3. Understanding Page:</strong></p>
<p>In the above picture of screen you can see the message URI system/application/views/welcome_message.php. That is the page which you currently seeing. Which have controller file in system/application/controllers/welcom.php.</p>
<p><strong>4. Creating a Simple Page in CodeIgniter</strong></p>
<p>Let me to start with controller page. Here I create a page blog.php. Copy the code below and paste in your text editor save it in system/application/controllers/</p>
<p><code>&lt;?phpclass Blog extends Controller {</p>
<p>function index()</p>
<p>{</p>
<p>$tutorial['my_tutorial'] = array(&#8217;Download CodeIgniter&#8217;, &#8216;Install in Local Machine&#8217;, &#8216;Understand MVC&#8217;, &#8216;Create your First Application&#8217;);</p>
<p>$tutorial['title'] = &#8220;CodeIgniter Tutorial&#8221;;</p>
<p>$tutorial['heading'] = &#8220;You Will Know&#8221;;</p>
<p>$this-&gt;load-&gt;view(&#8217;blogpage&#8217;, $tutorial);</p>
<p>}</p>
<p>}</p>
<p>?&gt;</p>
<p></code></p>
<p>And now create another file blogpage and save it in system\application\views.</p>
<p><code>&lt;html&gt;&lt;head&gt;</p>
<p>&lt;title&gt;&lt;?php echo $title;?&gt;&lt;/title&gt;</p>
<p>&lt;/head&gt;</p>
<p>&lt;body&gt;</p>
<p>&lt;h2&gt;&lt;?php echo $heading;?&gt;&lt;/h2&gt;</p>
<p>&lt;p&gt;&lt;strong&gt;My Todo List&lt;/strong&gt;&lt;/p&gt;</p>
<p>&lt;ul&gt;</p>
<p>&lt;?php foreach($my_tutorial as $item):?&gt;</p>
<p>&lt;li&gt;&lt;?php echo $item;?&gt;&lt;/li&gt;</p>
<p>&lt;?php endforeach;?&gt;</p>
<p>&lt;/ul&gt;</p>
<p>&lt;/body&gt;</p>
<p>&lt;/html&gt;</p>
<p></code></p>
<p>Ok Now Test your first Program that should be http://localhost/blog/index.php/blog</p>
<p><img src="http://www.jagadishwor.com.np/wp-content/uploads/2009/12/ci_logo.gif" alt="" width="243" height="68" /></p>
<map name="Map">
<area shape="rect" coords="18,21,249,71" href="http://codeigniter.com/download.php" target="_blank"></area>
<area shape="rect" coords="20,126,248,168" href="http://codeigniter.com/tutorials/" target="_blank"></area>
<area shape="rect" coords="20,171,249,215" href="http://codeigniter.com/forums/" target="_blank"></area>
<area shape="rect" coords="18,74,247,123" href="http://codeigniter.com/user_guide/" target="_blank"></area>
</map>
<h3>View Also</h3>
<ul class="related_post">
<li><a href="http://www.jagadishwor.com.np/2009/07/search-engine-optimization-strategies/" title="Search Engine Optimization Strategies">Search Engine Optimization Strategies</a></li>
<li><a href="http://www.jagadishwor.com.np/2009/02/create-wordpress-themes-from-scratch/" title="Create WordPress Themes from Scratch">Create WordPress Themes from Scratch</a></li>
<li><a href="http://www.jagadishwor.com.np/2009/08/how-to-create-a-movieclip-rotating-around-the-center-continiously/" title="How to Create a MovieClip Rotating around the Center Continiously ">How to Create a MovieClip Rotating around the Center Continiously </a></li>
<li><a href="http://www.jagadishwor.com.np/2009/03/adsense-ready-wordpress-themes/" title="Adsense Ready Wordpress Themes">Adsense Ready Wordpress Themes</a></li>
<li><a href="http://www.jagadishwor.com.np/2009/02/download-official-google-seo-starter-guide-pdf/" title="Download Official Google SEO Starter Guide PDF">Download Official Google SEO Starter Guide PDF</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.jagadishwor.com.np/2009/12/codeigniter-tutorial-for-beginners/feed/</wfw:commentRss>
		</item>
		<item>
		<title>CSS style for CMS system</title>
		<link>http://www.jagadishwor.com.np/2009/12/css-style-for-cms-system/</link>
		<comments>http://www.jagadishwor.com.np/2009/12/css-style-for-cms-system/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 05:50:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[CSS]]></category>

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

		<guid isPermaLink="false">http://www.jagadishwor.com.np/?p=247</guid>
		<description><![CDATA[Previously I have written a full text page having Complete Tutorial For Developing own CMS System. On the request of my readers I am going to post the CSS style for the code.
@charset "utf-8";
/* CSS Document */body{
margin:0;
padding:0;
font: 11px "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
}
.sitetitle{
padding:0px 0px 0px 25px;
font-family: "Arial";
display: inline;
color: white;
font-size: 24px;
font-weight: bold;
vertical-align: middle;
}
.dispaly{
border:1px [...]]]></description>
			<content:encoded><![CDATA[<p>Previously I have written a full text page having Complete Tutorial For Developing own CMS System. On the request of my readers I am going to post the CSS style for the code.</p>
<p><code>@charset "utf-8";<br />
/* CSS Document */body{<br />
margin:0;<br />
padding:0;<br />
font: 11px "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;<br />
}<br />
.sitetitle{<br />
padding:0px 0px 0px 25px;<br />
font-family: "Arial";<br />
display: inline;<br />
color: white;<br />
font-size: 24px;<br />
font-weight: bold;<br />
vertical-align: middle;<br />
}<br />
.dispaly{<br />
border:1px solid #8c8c8c;<br />
}<br />
.menu{<br />
padding:3px 5px 3px 10px;<br />
color:#0099CC;<br />
font-weight:bold;<br />
font-size:12px;<br />
text-decoration:none;<br />
}<br />
.menu a{<br />
padding:3px 5px 3px 10px;<br />
color:#0099CC;<br />
font-weight:bold;<br />
font-size:12px;<br />
text-decoration:none;<br />
}<br />
h1{<br />
font-size:16px;<br />
color:#006699;<br />
padding-top:10px;<br />
text-decoration:none;<br />
}<br />
h1 span{<br />
font-size:10px;<br />
color:#999999;<br />
text-align:right;<br />
padding-right:0px 20px 0px 30px;<br />
font-weight:normal;<br />
}<br />
h1 a{<br />
font-size:16px;<br />
color:#0099CC;<br />
padding-top:10px;<br />
text-decoration:none;<br />
}<br />
.posted{<br />
font-size:10px;<br />
color:#999999;<br />
text-align:right;<br />
font-weight:normal;<br />
}<br />
.archtitle{<br />
font-size:12px;<br />
font-weight:bold;<br />
color:#FFFFFF;<br />
text-align:center;<br />
}<br />
.menupost{<br />
font-size:11px;<br />
color:#FFFFFF;<br />
text-decoration:none;<br />
}<br />
.menupost a{<br />
font-size:11px;<br />
color:#FFFFFF;<br />
text-decoration:none;<br />
}.footertext{<br />
padding:0px 10px 0px 10px;<br />
text-align:center;<br />
color:#FFFFFF;<br />
font-size:12px;<br />
}<br />
.footertext a{<br />
text-align:center;<br />
color:#FFFFFF;<br />
font-size:12px;<br />
text-decoration:none;<br />
}</p>
<p></code><br />
You can <a href="http://www.jagadishwor.com.np/download/cms.zip">Download Zip </a>file Here<br />
<h3>Related Articles</h3>
<ul class="related_post">
<li><a href="http://www.jagadishwor.com.np/2010/02/php-array-functions/" title="PHP Array Functions">PHP Array Functions</a></li>
<li><a href="http://www.jagadishwor.com.np/2009/12/10-simple-php-login-sytem-tutorial/" title="10 Simple PHP Login Sytem Tutorial ">10 Simple PHP Login Sytem Tutorial </a></li>
<li><a href="http://www.jagadishwor.com.np/2009/11/php-mysql-own-cms-system-tutorial/" title="PHP Mysql own CMS system Tutorial">PHP Mysql own CMS system Tutorial</a></li>
<li><a href="http://www.jagadishwor.com.np/2009/10/php-image-file-upload-tutorial/" title="PHP Image File Upload Tutorial">PHP Image File Upload Tutorial</a></li>
<li><a href="http://www.jagadishwor.com.np/2009/09/php-simple-session-tutorial/" title="PHP Simple Session Tutorial">PHP Simple Session Tutorial</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.jagadishwor.com.np/2009/12/css-style-for-cms-system/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PHP Mysql own CMS system Tutorial</title>
		<link>http://www.jagadishwor.com.np/2009/11/php-mysql-own-cms-system-tutorial/</link>
		<comments>http://www.jagadishwor.com.np/2009/11/php-mysql-own-cms-system-tutorial/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 16:31:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

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

		<guid isPermaLink="false">http://www.jagadishwor.com.np/?p=241</guid>
		<description><![CDATA[In this tutorial I am going to show you how you can develop a simple CMS (Content Management System) in a very quick and easy way. In this tutorial I have used table for layout. You can use your CSS style for develop your CMS.
Let&#8217;s begain with Database.
Create Database CMS for your CMS site
Copy and [...]]]></description>
			<content:encoded><![CDATA[<p>In this tutorial I am going to show you how you can develop a simple CMS (Content Management System) in a very quick and easy way. In this tutorial I have used table for layout. You can use your CSS style for develop your CMS.</p>
<p>Let&#8217;s begain with Database.</p>
<p>Create Database CMS for your CMS site</p>
<p>Copy and paste the following query to create quick tables. Or you can create your own as you wish.</p>
<pre><code>
  CREATE TABLE `siteconfig` (

  `id` int(11) NOT NULL auto_increment,

  `cmstitle` varchar(200) collate latin1_general_ci NOT NULL,

  `version` varchar(50) collate latin1_general_ci NOT NULL,

  `copyinfo` varchar(200) collate latin1_general_ci NOT NULL,

  PRIMARY KEY (`id`)

) ENGINE=MyISAM

INSERT INTO `siteconfig` (`id`, `cmstitle`, `version`, `copyinfo`) VALUES

(1, 'Jagadishwor''s Simple CMS System', 'Version 1.0', 'Copyright © &lt;a href="http://www.jagadishwor.com.np"&gt;Jagadishwor.com.np&lt;/a&gt; 2009');

CREATE TABLE `tblcategory` (

`catid` int(11) NOT NULL auto_increment,

`catname` varchar(100) collate latin1_general_ci NOT NULL,

PRIMARY KEY (`catid`)

) ENGINE=MyISAM

INSERT INTO `tblcategory` (`catid`, `catname`) VALUES

(1, 'AJAX'),

(3, 'MYSQL'),

(4, 'Wordpress'),

(5, 'CSS');

CREATE TABLE `tblpost` (

`postid` int(11) NOT NULL auto_increment,

`heading` varchar(250) collate latin1_general_ci NOT NULL,

`article` longtext collate latin1_general_ci NOT NULL,

`postdate` date NOT NULL,

`postby` varchar(200) collate latin1_general_ci NOT NULL,

`catid` int(11) NOT NULL,

`posttag` varchar(100) collate latin1_general_ci NOT NULL,

`status` int(1) NOT NULL,

PRIMARY KEY (`postid`)

) ENGINE=MyISAM</code></pre>
<p>Now We will start to develop our Content Management System</p>
<p><img src="http://www.jagadishwor.com.np/wp-content/uploads/2009/11/indexpage.gif" alt="" width="500" height="271" /></p>
<p>Before we start we will discuss about the layout and pages.</p>
<p>In this tutorial I am going to develop pages like this:</p>
<p>header.php</p>
<p>menu.php</p>
<p>archieves.php</p>
<p>index.php</p>
<p>footer.php</p>
<p>sidebar.php</p>
<p>category.php</p>
<p>result.php</p>
<p>article.php</p>
<p>style.css</p>
<p>include/constr.php</p>
<p>include/definer.php</p>
<p>Create a database connection string inside include folder:</p>
<pre><code> &lt;?php

  $db_host = "localhost";

  $db_user = "root";//Change to your mysql user 

  $db_pass = ""; // Change to your mysql password

  $db_name = "cms";

  mysql_connect($db_host, $db_user, $db_pass) or die(mysql_error());

    mysql_select_db($db_name);

    ?&gt;

</code></pre>
<p>Now I am going to define some value for our CMS like title, copyinfo and version in definer. I will update it in my comming system. Create definer.php inside your include folder and paste the code:</p>
<pre><code>
&lt;?php

$query='SELECT * from siteconfig';

$result=mysql_query($query);

if(!$result){

die('No Title Found For This Page because '. mysql_error());

}else{

$row=mysql_fetch_array($result);

$title=$row['cmstitle'];

$version=$row['version'];

$copyright=$row['copyinfo'];

}

?&gt;</code></pre>
<p>Create a new php file name it index.php and save it in your root.</p>
<pre><code>
&lt;?php include 'header.php';?&gt;

&lt;tr&gt;

&lt;td colspan="2"&gt;&lt;table width="100%" border="0" cellpadding="0" cellspacing="0" class="dispaly"&gt;

&lt;tr&gt;

&lt;td&gt;&lt;table width="96%" border="0" cellspacing="0" cellpadding="0" align="center"&gt;

&lt;?php

$rowsPerPage = 7;

$pageNum = 1;

if(isset($_GET['page']))

{

$pageNum = $_GET['page'];

}

$offset = ($pageNum - 1) * $rowsPerPage;

$qry="SELECT a.*, b.catname FROM `tblpost` a, `tblcategory` b WHERE a.catid=b.catid ORDER BY a.postid DESC LIMIT $offset, $rowsPerPage";

$result=mysql_query($qry);

while($row=mysql_fetch_array($result)){

?&gt;

&lt;tr&gt;

&lt;td&gt;&lt;h1&gt;&lt;a href="article.php?id=&lt;?php echo $row['postid'];?&gt;"&gt;&lt;?php echo $row['heading'];?&gt;&lt;/a&gt;&lt;span&gt;&amp;nbsp;&amp;raquo;&lt;?php echo $row['postdate'];?&gt;&lt;/span&gt;&lt;/h1&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;span class="posted"&gt;&lt;strong&gt;Posted By: &lt;/strong&gt;&lt;em&gt;&lt;?php echo $row['postby'];?&gt;&lt;/em&gt;&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;strong&gt;Under Category: &lt;/strong&gt;&lt;em&gt;&lt;?php echo $row['catname'];?&gt;&lt;/em&gt;&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;strong&gt;Under Tag: &lt;/strong&gt;&lt;em&gt;&lt;?php echo $row['posttag'];?&gt;&lt;/em&gt;&lt;/span&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;?php echo substr(str_replace("\r\n","&lt;br&gt;",$row['article']),0,400)."&amp;nbsp;&amp;nbsp; &lt;a href='article.php?id=$row[postid]'&gt;Read More...&lt;/a&gt;";?&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;?php

}

?&gt;

&lt;tr&gt;

&lt;td&gt;&lt;center&gt;

&lt;?php

$query = "SELECT COUNT(postid) AS numrows FROM tblpost";

$result = mysql_query($query) or die('Error, query failed');

$row = mysql_fetch_array($result, MYSQL_ASSOC);

$numrows = $row['numrows'];

$maxPage = ceil($numrows/$rowsPerPage);

$self = $_SERVER['PHP_SELF'];

$nav = '';

for($page = 1; $page &lt;= $maxPage; $page++)

{

if ($page == $pageNum)

{

$nav .= " $page "; // no need to create a link to current page

}

else

{

$nav .= " &lt;a href=\"$self?action=view-news&amp;page=$page\"&gt;$page&lt;/a&gt; ";

} 

}

if ($pageNum &gt; 1)

{

$page = $pageNum - 1;

$prev = " &lt;a href=\"$self?action=view-news&amp;page=$page\"&gt;[Prev]&lt;/a&gt; ";

$first = " &lt;a href=\"$self?action=view-news&amp;page=1\"&gt;[First Page]&lt;/a&gt; ";

} 

else

{

$prev = '&amp;nbsp;'; // we're on page one, don't print previous link

$first = '&amp;nbsp;'; // nor the first page link

}

if ($pageNum &lt; $maxPage)

{

$page = $pageNum + 1;

$next = " &lt;a href=\"$self?action=view-news&amp;page=$page\"&gt;[Next]&lt;/a&gt; ";

$last = " &lt;a href=\"$self?action=view-news&amp;page=$maxPage\"&gt;[Last Page]&lt;/a&gt; ";

} 

else

{

$next = '&amp;nbsp;'; // we're on the last page, don't print next link

$last = '&amp;nbsp;'; // nor the last page link

}

// print the navigation link

echo $prev . $nav . $next."&lt;br&gt;";

echo "Page $pageNum of $maxPage";

// and close the database connection

?&gt;&lt;/center&gt;

&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;td width="24%" bgcolor="#8c8c8c" valign="top" align="center"&gt;&lt;?php include 'sidebar.php';?&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;?php include 'footer.php';?&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;

&lt;/body&gt;

&lt;/html&gt;</code></pre>
<p>Paste code for your header.php file under your root folder.</p>
<pre><code>
&lt;?php include 'include/constr.php';?&gt;

&lt;?php include 'include/definer.php';?&gt;

&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;

&lt;html&gt;

&lt;head&gt;

&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;

&lt;title&gt;&lt;?php echo $title;?&gt;&lt;/title&gt;

&lt;link href="style.css" rel="stylesheet" type="text/css"&gt;

&lt;/head&gt;

&lt;body&gt;

&lt;table width="980" border="0" align="center" cellpadding="0" cellspacing="0"&gt;

&lt;tr&gt;

&lt;td&gt;&lt;table width="100%" border="0" cellpadding="0" cellspacing="0"&gt;

&lt;tr bgcolor="#464646"&gt;

&lt;td height="90" colspan="3"&gt;&lt;span class="sitetitle"&gt;&lt;?php echo $title;?&gt;&lt;/span&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td colspan="3"&gt;&lt;table width="100%" border="0" cellpadding="0" cellspacing="0"&gt;

&lt;tr&gt;

&lt;td width="76%" height="35"&gt;&lt;span class="menu"&gt;&lt;?php echo $home="&lt;a href='index.php'&gt; Home &lt;/a&gt;&amp;nbsp;| &amp;nbsp;";?&gt;&lt;?php include 'menu.php';?&gt;&lt;/span&gt;&lt;/td&gt;

&lt;td width="24%" valign="middle"&gt;&lt;form name="form1" method="post" action="result.php"&gt;

Search 

&lt;input name="search" type="text" id="search" size="20"&gt;

&lt;input type="submit" name="Submit" value="Go"&gt;

&lt;/form&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;</code></pre>
<p>Create footer.php in the same location</p>
<pre><code>
&lt;tr&gt;

&lt;td colspan="3"&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr bgcolor="#6d6d6d"&gt;

&lt;td width="33%" height="40"&gt;&lt;span class="footertext"&gt;&lt;?php echo $copyright;?&gt;&lt;/span&gt;&lt;/td&gt;

&lt;td width="43%"&gt;&amp;nbsp;&lt;/td&gt;

&lt;td&gt;&lt;span class="footertext"&gt;&lt;em&gt;&lt;?php echo $version;?&gt;&lt;/em&gt;&lt;/span&gt;&lt;/td&gt;

&lt;/tr&gt;</code></pre>
<p>Create sidebar.php in the root directory and paste code</p>
<pre><code>
&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;

&lt;tr&gt;

&lt;td height="30" bgcolor="#4d4d4d"&gt;&lt;span class="archtitle"&gt;Archieve&lt;/span&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;

&lt;?php

$query="SELECT MONTH(postdate) MONTH, MONTHNAME(postdate)MONTHNAME, YEAR(postdate)year FROM tblpost GROUP BY MONTH(postdate) , YEAR(postdate) ORDER BY postdate";

$result=mysql_query($query);

while($row=mysql_fetch_array($result)){

?&gt;

&lt;tr&gt;

&lt;td bgcolor="#FFFFFF" height="2px"&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="20"&gt;&lt;span class="menupost"&gt;&lt;a href="archieves.php?month=&lt;?php echo $row['MONTH'];?&gt;&amp;year=&lt;?php echo $row['year'];?&gt;"&gt;&lt;?php echo $row['MONTHNAME']."-". $row['year'];?&gt;&lt;/a&gt;&lt;/span&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;?php

}

?&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="30" bgcolor="#4d4d4d"&gt;&lt;span class="archtitle"&gt;Recent Post&lt;/span&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;

&lt;tr&gt;

&lt;td&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;?php

$query="SELECT postid, heading, article FROM tblpost ORDER BY postid DESC LIMIT 0,10";

$result=mysql_query($query);

while($row=mysql_fetch_array($result)){

?&gt;

&lt;tr&gt;

&lt;td bgcolor="#FFFFFF" height="2px"&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td align="left"&gt;&lt;span class="menupost"&gt;&amp;raquo;&amp;nbsp;&lt;a href="article.php?id=&lt;?php echo $row['postid'];?&gt;"&gt;&lt;strong&gt;&lt;?php echo $row['heading'];?&gt;: &lt;/strong&gt;&lt;?php echo substr($row['article'], 0, 40)." ...";?&gt;&lt;/a&gt;&lt;/span&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;?php

}

?&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;</code></pre>
<p>To display menu create menu.php in your root and paste the code</p>
<pre><code>
&lt;?php

$qry="SELECT * FROM tblcategory ORDER BY catid ASC";

$result=mysql_query($qry);

while($row=mysql_fetch_array($result)){

echo "&lt;a href='category.php?catid=$row[catid]'&gt;".$row['catname']."&lt;/a&gt;". "&amp;nbsp; | &amp;nbsp;";

}

?&gt;</code></pre>
<p>We complete our index page and now you can test your index page. For more option we will develop four more pages which will display content on the basis of articles (Full article), archieves, search result and category.</p>
<p>Now first create article.php page and paste the following code</p>
<pre><code>
&lt;?php include 'header.php';?&gt;

&lt;tr&gt;

&lt;td colspan="2"&gt;&lt;table width="100%" border="0" cellpadding="0" cellspacing="0" class="dispaly"&gt;

&lt;tr&gt;

&lt;td&gt;&lt;table width="96%" border="0" cellspacing="0" cellpadding="0" align="center"&gt;

&lt;?php

if(isset($_GET['id'])){

$id=$_GET['id'];

if($id!=""){

$qry="SELECT a.*, b.catname FROM `tblpost` a, `tblcategory` b WHERE a.catid=b.catid and a.postid='$id'";

$result=mysql_query($qry);

if(mysql_num_rows($result)&lt;1){

echo "Sorry No post found!";

}

while($row=mysql_fetch_array($result)){

?&gt;

&lt;tr&gt;

&lt;td&gt;&lt;h1&gt;&lt;a href="article.php?id=&lt;?php echo $row['postid'];?&gt;"&gt;&lt;?php echo $row['heading'];?&gt;&lt;/a&gt;&lt;span&gt;&amp;nbsp;&amp;raquo;&lt;?php echo $row['postdate'];?&gt;&lt;/span&gt;&lt;/h1&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;span class="posted"&gt;&lt;strong&gt;Posted By: &lt;/strong&gt;&lt;em&gt;&lt;?php echo $row['postby'];?&gt;&lt;/em&gt;&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;strong&gt;Under Category: &lt;/strong&gt;&lt;em&gt;&lt;?php echo $row['catname'];?&gt;&lt;/em&gt;&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;strong&gt;Under Tag: &lt;/strong&gt;&lt;em&gt;&lt;?php echo $row['posttag'];?&gt;&lt;/em&gt;&lt;/span&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;?php echo str_replace("\r\n","&lt;br&gt;",$row['article']);?&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;?php

}

?&gt;

&lt;tr&gt;

&lt;td&gt;

&lt;?php

}

}

?&gt;

&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&amp;nbsp;

&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;td width="24%" bgcolor="#8c8c8c" valign="top" align="center"&gt;&lt;?php include 'sidebar.php';?&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;?php include 'footer.php';?&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;

&lt;/body&gt;

&lt;/html&gt;</code></pre>
<p>Create category.php page and paste code</p>
<pre><code> &lt;?php include 'header.php';?&gt;

&lt;tr&gt;

&lt;td colspan="2"&gt;&lt;table width="100%" border="0" cellpadding="0" cellspacing="0" class="dispaly"&gt;

&lt;tr&gt;

&lt;td&gt;&lt;table width="96%" border="0" cellspacing="0" cellpadding="0" align="center"&gt;

&lt;?php

  $catid=$_GET['catid'];

  $rowsPerPage = 7;

  $pageNum = 1;

  if(isset($_GET['page']))

  {

  $pageNum = $_GET['page'];

  }

  $offset = ($pageNum - 1) * $rowsPerPage;

  $qry="SELECT a.*, b.catname FROM `tblpost` a, `tblcategory` b WHERE a.catid=b.catid and a.catid='$catid' ORDER BY a.postid DESC LIMIT $offset, $rowsPerPage";

  $result=mysql_query($qry);

  if(mysql_num_rows($result)&lt;1){

  echo "Sorry No post found!";

  }

  while($row=mysql_fetch_array($result)){

  ?&gt;

&lt;tr&gt;

&lt;td&gt;&lt;h1&gt;&lt;a href="article.php?id=&lt;?php echo $row['postid'];?&gt;"&gt;&lt;?php echo $row['heading'];?&gt;&lt;/a&gt;&lt;span&gt;&amp;nbsp;&amp;raquo;&lt;?php echo $row['postdate'];?&gt;&lt;/span&gt;&lt;/h1&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;span class="posted"&gt;&lt;strong&gt;Posted By: &lt;/strong&gt;&lt;em&gt;&lt;?php echo $row['postby'];?&gt;&lt;/em&gt;&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;strong&gt;Under Category: &lt;/strong&gt;&lt;em&gt;&lt;?php echo $row['catname'];?&gt;&lt;/em&gt;&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;strong&gt;Under Tag: &lt;/strong&gt;&lt;em&gt;&lt;?php echo $row['posttag'];?&gt;&lt;/em&gt;&lt;/span&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;?php echo substr(str_replace("\r\n","&lt;br&gt;",$row['article']),0,400)."&amp;nbsp;&amp;nbsp; &lt;a href='article.php?id=$row[postid]'&gt;Read More...&lt;/a&gt;";?&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;?php

  }

  ?&gt;

&lt;tr&gt;

&lt;td&gt;&lt;center&gt;

&lt;?php

  $query = "SELECT COUNT(postid) AS numrows FROM tblpost";

  $result = mysql_query($query) or die('Error, query failed');

  $row = mysql_fetch_array($result, MYSQL_ASSOC);

  $numrows = $row['numrows'];

  $maxPage = ceil($numrows/$rowsPerPage);

  $self = $_SERVER['PHP_SELF'];

  $nav = '';

  for($page = 1; $page &lt;= $maxPage; $page++)

  {

  if ($page == $pageNum)

  {

  $nav .= " $page "; // no need to create a link to current page

  }

  else

  {

  $nav .= " &lt;a href=\"$self?action=view-news&amp;page=$page\"&gt;$page&lt;/a&gt; ";

  } 

  }

  if ($pageNum &gt; 1)

  {

  $page = $pageNum - 1;

  $prev = " &lt;a href=\"$self?action=view-news&amp;page=$page\"&gt;[Prev]&lt;/a&gt; ";

  $first = " &lt;a href=\"$self?action=view-news&amp;page=1\"&gt;[First Page]&lt;/a&gt; ";

  } 

  else

  {

  $prev = '&amp;nbsp;'; // we're on page one, don't print previous link

  $first = '&amp;nbsp;'; // nor the first page link

  }

  if ($pageNum &lt; $maxPage)

  {

  $page = $pageNum + 1;

  $next = " &lt;a href=\"$self?action=view-news&amp;page=$page\"&gt;[Next]&lt;/a&gt; ";

  $last = " &lt;a href=\"$self?action=view-news&amp;page=$maxPage\"&gt;[Last Page]&lt;/a&gt; ";

  } 

  else

  {

  $next = '&amp;nbsp;'; // we're on the last page, don't print next link

  $last = '&amp;nbsp;'; // nor the last page link

  }

  // print the navigation link

  echo $prev . $nav . $next."&lt;br&gt;";

  echo "Page $pageNum of $maxPage";

  // and close the database connection

  ?&gt;&lt;/center&gt;

&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;td width="24%" bgcolor="#8c8c8c" valign="top" align="center"&gt;&lt;?php include 'sidebar.php';?&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;?php include 'footer.php';?&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;

&lt;/body&gt;

&lt;/html&gt;

</code></pre>
<p>Now create archieves.php page to show archieve list.</p>
<pre><code>
&lt;?php include 'header.php';?&gt;

&lt;tr&gt;

&lt;td colspan="2"&gt;&lt;table width="100%" border="0" cellpadding="0" cellspacing="0" class="dispaly"&gt;

&lt;tr&gt;

&lt;td&gt;&lt;table width="96%" border="0" cellspacing="0" cellpadding="0" align="center"&gt;

&lt;?php

$month=$_GET['month'];

$year=$_GET['year'];

$date=$year."-".$month;

$rowsPerPage = 7;

$pageNum = 1;

if(isset($_GET['page']))

{

$pageNum = $_GET['page'];

}

$offset = ($pageNum - 1) * $rowsPerPage;

$qry="SELECT a.*, b.catname FROM `tblpost` a, `tblcategory` b WHERE a.catid=b.catid and MONTH(a.postdate)='$month' and YEAR(a.postdate)='$year' ORDER BY a.postdate DESC LIMIT $offset, $rowsPerPage";

$result=mysql_query($qry);

if(mysql_num_rows($result)&lt;1){

echo "Sorry No post found!";

}

while($row=mysql_fetch_array($result)){

?&gt;

&lt;tr&gt;

&lt;td&gt;&lt;h1&gt;&lt;a href="article.php?id=&lt;?php echo $row['postid'];?&gt;"&gt;&lt;?php echo $row['heading'];?&gt;&lt;/a&gt;&lt;span&gt;&amp;nbsp;&amp;raquo;&lt;?php echo $row['postdate'];?&gt;&lt;/span&gt;&lt;/h1&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;span class="posted"&gt;&lt;strong&gt;Posted By: &lt;/strong&gt;&lt;em&gt;&lt;?php echo $row['postby'];?&gt;&lt;/em&gt;&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;strong&gt;Under Category: &lt;/strong&gt;&lt;em&gt;&lt;?php echo $row['catname'];?&gt;&lt;/em&gt;&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;strong&gt;Under Tag: &lt;/strong&gt;&lt;em&gt;&lt;?php echo $row['posttag'];?&gt;&lt;/em&gt;&lt;/span&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;?php echo substr(str_replace("\r\n","&lt;br&gt;",$row['article']),0,400)."&amp;nbsp;&amp;nbsp; &lt;a href='article.php?id=$row[postid]'&gt;Read More...&lt;/a&gt;";?&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;?php

}

?&gt;

&lt;tr&gt;

&lt;td&gt;&lt;center&gt;

&lt;?php

$query = "SELECT COUNT(postid) AS numrows FROM tblpost";

$result = mysql_query($query) or die('Error, query failed');

$row = mysql_fetch_array($result, MYSQL_ASSOC);

$numrows = $row['numrows'];

$maxPage = ceil($numrows/$rowsPerPage);

$self = $_SERVER['PHP_SELF'];

$nav = '';

for($page = 1; $page &lt;= $maxPage; $page++)

{

if ($page == $pageNum)

{

$nav .= " $page "; // no need to create a link to current page

}

else

{

$nav .= " &lt;a href=\"$self?action=view-news&amp;page=$page\"&gt;$page&lt;/a&gt; ";

} 

}

if ($pageNum &gt; 1)

{

$page = $pageNum - 1;

$prev = " &lt;a href=\"$self?action=view-news&amp;page=$page\"&gt;[Prev]&lt;/a&gt; ";

$first = " &lt;a href=\"$self?action=view-news&amp;page=1\"&gt;[First Page]&lt;/a&gt; ";

} 

else

{

$prev = '&amp;nbsp;'; // we're on page one, don't print previous link

$first = '&amp;nbsp;'; // nor the first page link

}

if ($pageNum &lt; $maxPage)

{

$page = $pageNum + 1;

$next = " &lt;a href=\"$self?action=view-news&amp;page=$page\"&gt;[Next]&lt;/a&gt; ";

$last = " &lt;a href=\"$self?action=view-news&amp;page=$maxPage\"&gt;[Last Page]&lt;/a&gt; ";

} 

else

{

$next = '&amp;nbsp;'; // we're on the last page, don't print next link

$last = '&amp;nbsp;'; // nor the last page link

}

// print the navigation link

echo $prev . $nav . $next."&lt;br&gt;";

echo "Page $pageNum of $maxPage";

// and close the database connection

?&gt;&lt;/center&gt;

&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;td width="24%" bgcolor="#8c8c8c" valign="top" align="center"&gt;&lt;?php include 'sidebar.php';?&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;?php include 'footer.php';?&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;

&lt;/body&gt;

&lt;/html&gt;

</code></pre>
<p>Now create page for search result, result.php</p>
<pre><code>
&lt;?php include 'header.php';?&gt;

&lt;tr&gt;

&lt;td colspan="2"&gt;&lt;table width="100%" border="0" cellpadding="0" cellspacing="0" class="dispaly"&gt;

&lt;tr&gt;

&lt;td&gt;&lt;table width="96%" border="0" cellspacing="0" cellpadding="0" align="center"&gt;

&lt;?php

if(isset($_POST['search'])){

$search=$_POST['search'];

} 

$rowsPerPage = 7;

$pageNum = 1;

if(isset($_GET['page']))

{

$pageNum = $_GET['page'];

}

$offset = ($pageNum - 1) * $rowsPerPage;

$qry="SELECT * FROM `tblpost` WHERE heading like '%$search%' or posttag like '%$search%'ORDER BY postid DESC LIMIT $offset, $rowsPerPage";

$result=mysql_query($qry);

if(mysql_num_rows($result)&lt;1){

echo "Sorry No post found for your search!";

}

while($row=mysql_fetch_array($result)){

?&gt;

&lt;tr&gt;

&lt;td&gt;&lt;h1&gt;&lt;a href="article.php?id=&lt;?php echo $row['postid'];?&gt;"&gt;&lt;?php echo $row['heading'];?&gt;&lt;/a&gt;&lt;span&gt;&amp;nbsp;&amp;raquo;&lt;?php echo $row['postdate'];?&gt;&lt;/span&gt;&lt;/h1&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;span class="posted"&gt;&lt;strong&gt;Posted By: &lt;/strong&gt;&lt;em&gt;&lt;?php echo $row['postby'];?&gt;&lt;/em&gt;&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;strong&gt;Under Category: &lt;/strong&gt;&lt;em&gt;&lt;?php 

$sql="SELECT catname from tblcategory WHERE catid=$row[catid]";

$res=mysql_query($sql);

$rowcat=mysql_fetch_array($res);

$catname=$rowcat['catname'];

echo $catname;

?&gt;&lt;/em&gt;&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;strong&gt;Under Tag: &lt;/strong&gt;&lt;em&gt;&lt;?php echo $row['posttag'];?&gt;&lt;/em&gt;&lt;/span&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;?php echo substr(str_replace("\r\n","&lt;br&gt;",$row['article']),0,400)."&amp;nbsp;&amp;nbsp; &lt;a href='article.php?id=$row[postid]'&gt;Read More...&lt;/a&gt;";?&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;?php

}

?&gt;

&lt;tr&gt;

&lt;td&gt;&lt;center&gt;

&lt;?php

$query = "SELECT COUNT(postid) AS numrows FROM tblpost";

$result = mysql_query($query) or die('Error, query failed');

$row = mysql_fetch_array($result, MYSQL_ASSOC);

$numrows = $row['numrows'];

$maxPage = ceil($numrows/$rowsPerPage);

$self = $_SERVER['PHP_SELF'];

$nav = '';

for($page = 1; $page &lt;= $maxPage; $page++)

{

if ($page == $pageNum)

{

$nav .= " $page "; // no need to create a link to current page

}

else

{

$nav .= " &lt;a href=\"$self?action=view-news&amp;page=$page\"&gt;$page&lt;/a&gt; ";

} 

}

if ($pageNum &gt; 1)

{

$page = $pageNum - 1;

$prev = " &lt;a href=\"$self?action=view-news&amp;page=$page\"&gt;[Prev]&lt;/a&gt; ";

$first = " &lt;a href=\"$self?action=view-news&amp;page=1\"&gt;[First Page]&lt;/a&gt; ";

} 

else

{

$prev = '&amp;nbsp;'; // we're on page one, don't print previous link

$first = '&amp;nbsp;'; // nor the first page link

}

if ($pageNum &lt; $maxPage)

{

$page = $pageNum + 1;

$next = " &lt;a href=\"$self?action=view-news&amp;page=$page\"&gt;[Next]&lt;/a&gt; ";

$last = " &lt;a href=\"$self?action=view-news&amp;page=$maxPage\"&gt;[Last Page]&lt;/a&gt; ";

} 

else

{

$next = '&amp;nbsp;'; // we're on the last page, don't print next link

$last = '&amp;nbsp;'; // nor the last page link

}

// print the navigation link

echo $prev . $nav . $next."&lt;br&gt;";

echo "Page $pageNum of $maxPage";

// and close the database connection

?&gt;&lt;/center&gt;

&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;td width="24%" bgcolor="#8c8c8c" valign="top" align="center"&gt;&lt;?php include 'sidebar.php';?&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;?php include 'footer.php';?&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;

&lt;/body&gt;

&lt;/html&gt;

</code></pre>
<p>OK our CMS for client side have been completed. Now create admin section for post articles and add category. Create folder admin in your root.</p>
<p><img src="http://www.jagadishwor.com.np/wp-content/uploads/2009/11/adminindex.gif" alt="" width="500" height="281" /></p>
<p>Now create a index.php file inside your root and paste the following code</p>
<pre><code>
&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;

&lt;html&gt;

&lt;head&gt;

&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;

&lt;title&gt;Jagadishwor's Simple CMS System&lt;/title&gt;

&lt;link href="../style.css" rel="stylesheet" type="text/css"&gt;

&lt;/head&gt;

&lt;body&gt;

&lt;table width="980" border="0" align="center" cellpadding="0" cellspacing="0"&gt;

&lt;tr&gt;

&lt;td&gt;&lt;table width="100%" border="0" cellpadding="0" cellspacing="0"&gt;

&lt;tr bgcolor="#464646"&gt;

&lt;td height="90" colspan="2" bgcolor="#464646"&gt;&lt;span class="sitetitle"&gt;Jagadishwor's Simple CMS System&lt;/span&gt;&lt;/td&gt;

&lt;td height="90"&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td colspan="3"&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt; &lt;tr&gt;

&lt;td colspan="2"&gt;&lt;table width="100%" border="0" cellpadding="0" cellspacing="0" class="dispaly"&gt;

&lt;tr&gt;

&lt;td&gt;&lt;form name="form1" method="post" action=""&gt;

&lt;table width="96%" border="0" cellspacing="0" cellpadding="0" align="center"&gt;

&lt;tr&gt;

&lt;td&gt;&lt;h1&gt;&lt;a href="article.php?id=1"&gt;Welcome admin Please click on the menu for your work. &lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/h1&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;center&gt;

&lt;/center&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;

&lt;/form&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;td width="24%" bgcolor="#8c8c8c" valign="top" align="center"&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;

&lt;tr&gt;

&lt;td height="30" bgcolor="#4d4d4d"&gt;&lt;span class="archtitle"&gt;Admin Menu &lt;/span&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;

&lt;tr&gt;

&lt;td bgcolor="#FFFFFF" height="2px"&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="20"&gt;&lt;span class="menupost"&gt;&lt;a href="addnew.php"&gt;Add New Post &lt;/a&gt;&lt;/span&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="2" bgcolor="#ffffff"&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="20"&gt;&lt;a href="viewpost.php" class="menupost"&gt;View Post &lt;/a&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="2" bgcolor="#ffffff"&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="20"&gt;&lt;a href="addcategory.php" class="menupost"&gt;Add New Category &lt;/a&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="2" bgcolor="#ffffff"&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="2" bgcolor="#ffffff"&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="30" bgcolor="#4d4d4d"&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;

&lt;tr&gt;

&lt;td&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td bgcolor="#FFFFFF" height="2px"&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;

&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td colspan="3"&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr bgcolor="#6d6d6d"&gt;

&lt;td width="33%" height="40"&gt;&lt;span class="footertext"&gt;Copyright © &lt;a href="http://www.jagadishwor.com.np"&gt;Jagadishwor.com.np&lt;/a&gt; 2009&lt;/span&gt;&lt;/td&gt;

&lt;td width="43%"&gt;&amp;nbsp;&lt;/td&gt;

&lt;td&gt;&lt;span class="footertext"&gt;&lt;em&gt;Version 1.0&lt;/em&gt;&lt;/span&gt;&lt;/td&gt;

&lt;/tr&gt; &lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;

&lt;/body&gt;

&lt;/html&gt;</code></pre>
<p>To add New post contents let&#8217;s add a new file addnew.php</p>
<pre><code>
&lt;?php include '../include/constr.php';?&gt;

&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;

&lt;html&gt;

&lt;head&gt;

&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;

&lt;title&gt;Jagadishwor's Simple CMS System&lt;/title&gt;

&lt;link href="../style.css" rel="stylesheet" type="text/css"&gt;

&lt;/head&gt;

&lt;body&gt;

&lt;table width="980" border="0" align="center" cellpadding="0" cellspacing="0"&gt;

&lt;tr&gt;

&lt;td&gt;&lt;table width="100%" border="0" cellpadding="0" cellspacing="0"&gt;

&lt;tr bgcolor="#464646"&gt;

&lt;td height="90" colspan="2" bgcolor="#464646"&gt;&lt;span class="sitetitle"&gt;Jagadishwor's Simple CMS System&lt;/span&gt;&lt;/td&gt;

&lt;td height="90"&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td colspan="3"&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt; &lt;tr&gt;

&lt;td colspan="2"&gt;&lt;table width="100%" border="0" cellpadding="0" cellspacing="0" class="dispaly"&gt;

&lt;tr&gt;

&lt;td&gt;&lt;form name="form1" method="post" action=""&gt;

&lt;table width="96%" border="0" cellspacing="0" cellpadding="0" align="center"&gt;

&lt;tr&gt;

&lt;td&gt;&lt;h1&gt;&lt;a href="article.php?id=1"&gt;Welcome admin Please click on the menu for your work. &lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/h1&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;table width="100%" border="0" cellspacing="3" cellpadding="3"&gt;

&lt;tr&gt;

&lt;td&gt;&lt;div align="right"&gt;&lt;strong&gt;Post Title &lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;

&lt;td&gt;&lt;input name="title" type="text" id="title" size="40"&gt;&lt;/td&gt;

&lt;td&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;div align="right"&gt;&lt;strong&gt;Post Contents &lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;

&lt;td&gt;&lt;textarea name="contents" cols="40" rows="10" id="contents"&gt;&lt;/textarea&gt;&lt;/td&gt;

&lt;td&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;div align="right"&gt;&lt;strong&gt;Category&lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;

&lt;td&gt;&lt;?php

$result = mysql_query("SELECT * FROM tblcategory");

echo "&lt;select name=\"catg\" id=\"catg\"&gt;";

while($row2 = mysql_fetch_array($result))

{

echo "&lt;option value=" . $row2['catid'] ."&gt;".$row2['catname'];

echo " &lt;/option&gt;";

}

echo "&lt;/select&gt;";

?&gt;&lt;/td&gt;

&lt;td&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;div align="right"&gt;&lt;strong&gt;Post By &lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;

&lt;td&gt;&lt;input name="postby" type="text" id="postby"&gt;&lt;/td&gt;

&lt;td&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;div align="right"&gt;&lt;strong&gt;Post Tags &lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;

&lt;td&gt;&lt;input name="tags" type="text" id="tags"&gt;&lt;/td&gt;

&lt;td&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&amp;nbsp;&lt;/td&gt;

&lt;td&gt;&lt;input name="addpost" type="submit" id="addpost" value="Add Post"&gt;&lt;/td&gt;

&lt;td&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;center&gt;

&lt;/center&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;

&lt;/form&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;td width="24%" bgcolor="#8c8c8c" valign="top" align="center"&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;

&lt;tr&gt;

&lt;td height="30" bgcolor="#4d4d4d"&gt;&lt;span class="archtitle"&gt;Admin Menu &lt;/span&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;

&lt;tr&gt;

&lt;td bgcolor="#FFFFFF" height="2px"&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="20"&gt;&lt;span class="menupost"&gt;&lt;a href="addnew.php"&gt;Add New Post &lt;/a&gt;&lt;/span&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="2" bgcolor="#ffffff"&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="20"&gt;&lt;a href="viewpost.php" class="menupost"&gt;View Post &lt;/a&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="2" bgcolor="#ffffff"&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="20"&gt;&lt;a href="addcategory.php" class="menupost"&gt;Add New Category &lt;/a&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="2" bgcolor="#ffffff"&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="2" bgcolor="#ffffff"&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="30" bgcolor="#4d4d4d"&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;

&lt;tr&gt;

&lt;td&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td bgcolor="#FFFFFF" height="2px"&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;

&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td colspan="3"&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr bgcolor="#6d6d6d"&gt;

&lt;td width="33%" height="40"&gt;&lt;span class="footertext"&gt;Copyright © &lt;a href="http://www.jagadishwor.com.np"&gt;Jagadishwor.com.np&lt;/a&gt; 2009&lt;/span&gt;&lt;/td&gt;

&lt;td width="43%"&gt;&amp;nbsp;&lt;/td&gt;

&lt;td&gt;&lt;span class="footertext"&gt;&lt;em&gt;Version 1.0&lt;/em&gt;&lt;/span&gt;&lt;/td&gt;

&lt;/tr&gt; &lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;

&lt;?php

if(isset($_POST['addpost'])){

$title=$_POST['title'];

$contents=$_POST['contents'];

$category=$_POST['catg'];

$postby=$_POST['postby'];

$today=date("Y-m-d");

$posttags=$_POST['tags'];

}

if(($title&lt;&gt;"") and ($contents&lt;&gt;"") and ($category&lt;&gt;"")){

$qry="INSERT into tblpost (heading, article, postdate, postby, catid, posttag, status) VALUES ('$title', '$contents', '$today', '$postby', '$category', '$posttag', '1')";

$result=mysql_query($qry);

if($result){

?&gt;

&lt;script&gt;

alert("New Post added Successfully")

window.location("addnew.php");

&lt;/script&gt;

&lt;?php

}else{

echo "Can not add your post.";

}

}

?&gt;

&lt;/body&gt;

&lt;/html&gt;</code></pre>
<p>To view and delete your post create new file viewpost.php</p>
<pre><code>
&lt;?php include '../include/constr.php';?&gt;

&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;

&lt;html&gt;

&lt;head&gt;

&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;

&lt;title&gt;Jagadishwor's Simple CMS System&lt;/title&gt;

&lt;link href="../style.css" rel="stylesheet" type="text/css"&gt;

&lt;/head&gt;

&lt;body&gt;

&lt;table width="980" border="0" align="center" cellpadding="0" cellspacing="0"&gt;

&lt;tr&gt;

&lt;td&gt;&lt;table width="100%" border="0" cellpadding="0" cellspacing="0"&gt;

&lt;tr bgcolor="#464646"&gt;

&lt;td height="90" colspan="2" bgcolor="#464646"&gt;&lt;span class="sitetitle"&gt;Jagadishwor's Simple CMS System&lt;/span&gt;&lt;/td&gt;

&lt;td height="90"&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td colspan="3"&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt; &lt;tr&gt;

&lt;td colspan="2"&gt;&lt;table width="100%" border="0" cellpadding="0" cellspacing="0" class="dispaly"&gt;

&lt;tr&gt;

&lt;td&gt;&lt;form name="form1" method="post" action=""&gt;

&lt;table width="96%" border="0" cellspacing="0" cellpadding="0" align="center"&gt;

&lt;tr&gt;

&lt;td&gt;&lt;h1&gt;&lt;a href="article.php?id=1"&gt;Welcome admin Please click on the menu for your work. &lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/h1&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;table width="100%" border="0" cellspacing="3" cellpadding="3"&gt;

&lt;tr&gt;

&lt;td&gt;&lt;div align="center"&gt;&lt;strong&gt;SNO&lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;

&lt;td&gt;&lt;div align="center"&gt;&lt;strong&gt;Title&lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;

&lt;td&gt;&lt;div align="center"&gt;&lt;strong&gt;Post Date &lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;

&lt;td&gt;&lt;div align="center"&gt;&lt;strong&gt;Category&lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;

&lt;td&gt;&lt;div align="center"&gt;&lt;strong&gt;Post By &lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;

&lt;td&gt;&lt;div align="center"&gt;&lt;strong&gt;Action&lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;?php

$qry="SELECT a.*, b.catname FROM `tblpost` a, `tblcategory` b WHERE a.catid=b.catid ORDER BY a.postid DESC";

$result=mysql_query($qry);

$sno=1;

while($row=mysql_fetch_array($result)){

?&gt;

&lt;tr&gt;

&lt;td&gt;&lt;?php echo $sno;?&gt;&lt;/td&gt;

&lt;td&gt;&lt;?php echo $row['heading'];?&gt;&lt;/td&gt;

&lt;td&gt;&lt;?php echo $row['postdate'];?&gt;&lt;/td&gt;

&lt;td&gt;&lt;?php echo $row['catname'];?&gt;&lt;/td&gt;

&lt;td&gt;&lt;?php echo $row['postby'];?&gt;&lt;/td&gt;

&lt;td&gt;&lt;a href="viewpost.php?action=delete&amp;id=&lt;?php echo $row['postid'];?&gt;"&gt;Delete&lt;/a&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;?php

$sno=$sno+1;

}

?&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;

&lt;/form&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;td width="24%" bgcolor="#8c8c8c" valign="top" align="center"&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;

&lt;tr&gt;

&lt;td height="30" bgcolor="#4d4d4d"&gt;&lt;span class="archtitle"&gt;Admin Menu &lt;/span&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;

&lt;tr&gt;

&lt;td bgcolor="#FFFFFF" height="2px"&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="20"&gt;&lt;span class="menupost"&gt;&lt;a href="addnew.php"&gt;Add New Post &lt;/a&gt;&lt;/span&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="2" bgcolor="#ffffff"&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="20"&gt;&lt;a href="viewpost.php" class="menupost"&gt;View Post &lt;/a&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="2" bgcolor="#ffffff"&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="20"&gt;&lt;a href="addcategory.php" class="menupost"&gt;Add New Category &lt;/a&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="2" bgcolor="#ffffff"&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="2" bgcolor="#ffffff"&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="30" bgcolor="#4d4d4d"&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;

&lt;tr&gt;

&lt;td&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td bgcolor="#FFFFFF" height="2px"&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;

&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td colspan="3"&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr bgcolor="#6d6d6d"&gt;

&lt;td width="33%" height="40"&gt;&lt;span class="footertext"&gt;Copyright © &lt;a href="http://www.jagadishwor.com.np"&gt;Jagadishwor.com.np&lt;/a&gt; 2009&lt;/span&gt;&lt;/td&gt;

&lt;td width="43%"&gt;&amp;nbsp;&lt;/td&gt;

&lt;td&gt;&lt;span class="footertext"&gt;&lt;em&gt;Version 1.0&lt;/em&gt;&lt;/span&gt;&lt;/td&gt;

&lt;/tr&gt; &lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;

&lt;?php

if(isset($_GET['action'])){

$id=$_GET['id'];

if($id&lt;&gt;""){

$sql="DELETE FROM tblcategory WHERE catid='$id'";

echo $sql;

$result=mysql_query($sql);

if($result){

?&gt;

&lt;script&gt;

alert("Article Deleted.")

window.location=("viewpost.php");

&lt;/script&gt;

&lt;?php

} 

}

}

?&gt;

&lt;/body&gt;

&lt;/html&gt;
</code></pre>
<p>OK finally to add category create page addcategory.php</p>
<pre><code>
&lt;?php include '../include/constr.php';?&gt;

&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;

&lt;html&gt;

&lt;head&gt;

&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;

&lt;title&gt;Jagadishwor's Simple CMS System&lt;/title&gt;

&lt;link href="../style.css" rel="stylesheet" type="text/css"&gt;

&lt;/head&gt;

&lt;body&gt;

&lt;table width="980" border="0" align="center" cellpadding="0" cellspacing="0"&gt;

&lt;tr&gt;

&lt;td&gt;&lt;table width="100%" border="0" cellpadding="0" cellspacing="0"&gt;

&lt;tr bgcolor="#464646"&gt;

&lt;td height="90" colspan="2" bgcolor="#464646"&gt;&lt;span class="sitetitle"&gt;Jagadishwor's Simple CMS System&lt;/span&gt;&lt;/td&gt;

&lt;td height="90"&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td colspan="3"&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt; &lt;tr&gt;

&lt;td colspan="2"&gt;&lt;table width="100%" border="0" cellpadding="0" cellspacing="0" class="dispaly"&gt;

&lt;tr&gt;

&lt;td&gt;&lt;form name="form1" method="post" action=""&gt;

&lt;table width="96%" border="0" cellspacing="0" cellpadding="0" align="center"&gt;

&lt;tr&gt;

&lt;td&gt;&lt;h1&gt;&lt;a href="article.php?id=1"&gt;Welcome admin Please click on the menu for your work. &lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/h1&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;table width="100%" border="0" cellspacing="3" cellpadding="3"&gt;

&lt;tr&gt;

&lt;td&gt;&lt;div align="right"&gt;&lt;strong&gt;Category Name &lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;

&lt;td&gt;&lt;input name="catname" type="text" id="catname" size="40"&gt;&lt;/td&gt;

&lt;td&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&amp;nbsp;&lt;/td&gt;

&lt;td&gt;&lt;input name="addcategory" type="submit" id="addcategory" value="Add New Category"&gt;&lt;/td&gt;

&lt;td&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;center&gt;

&lt;/center&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;

&lt;/form&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;td width="24%" bgcolor="#8c8c8c" valign="top" align="center"&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;

&lt;tr&gt;

&lt;td height="30" bgcolor="#4d4d4d"&gt;&lt;span class="archtitle"&gt;Admin Menu &lt;/span&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;

&lt;tr&gt;

&lt;td bgcolor="#FFFFFF" height="2px"&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="20"&gt;&lt;span class="menupost"&gt;&lt;a href="addnew.php"&gt;Add New Post &lt;/a&gt;&lt;/span&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="2" bgcolor="#ffffff"&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="20"&gt;&lt;a href="viewpost.php" class="menupost"&gt;View Post &lt;/a&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="2" bgcolor="#ffffff"&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="20"&gt;&lt;a href="addcategory.php" class="menupost"&gt;Add New Category &lt;/a&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="2" bgcolor="#ffffff"&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="2" bgcolor="#ffffff"&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td height="30" bgcolor="#4d4d4d"&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;

&lt;tr&gt;

&lt;td&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td bgcolor="#FFFFFF" height="2px"&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;

&lt;/td&gt;

&lt;/tr&gt;

&lt;tr&gt;

&lt;td colspan="3"&gt;&amp;nbsp;&lt;/td&gt;

&lt;/tr&gt;

&lt;tr bgcolor="#6d6d6d"&gt;

&lt;td width="33%" height="40"&gt;&lt;span class="footertext"&gt;Copyright © &lt;a href="http://www.jagadishwor.com.np"&gt;Jagadishwor.com.np&lt;/a&gt; 2009&lt;/span&gt;&lt;/td&gt;

&lt;td width="43%"&gt;&amp;nbsp;&lt;/td&gt;

&lt;td&gt;&lt;span class="footertext"&gt;&lt;em&gt;Version 1.0&lt;/em&gt;&lt;/span&gt;&lt;/td&gt;

&lt;/tr&gt; &lt;/table&gt;&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;

&lt;?php

if(isset($_POST['addcategory'])){

$catg=$_POST['catname'];

}

if($catg&lt;&gt;""){

$sql="INSERT into tblcategory (catid, catname) values(NULL, '$catg')";

$result=mysql_query($sql) or die('Can not Add New Category');

if($result){

echo "Category Added. Returning Back. Please Wait";

?&gt;

&lt;script&gt;

alert("Category added returning to back")

window.location=("addcategory.php");

&lt;/script&gt;

&lt;?php

} 

}

?&gt;

&lt;/body&gt;

&lt;/html&gt;</code></pre>
<p>Wow! you complete your CMS system. I hope you understand all my codes. It&#8217;s very easy way to develop CMS System using php and mysql. I am developing a CMS system which will be online for all my readers who want their own CMS system very soon.<br />
<h3>Related Articles</h3>
<ul class="related_post">
<li><a href="http://www.jagadishwor.com.np/2009/08/delete-multiple-records-using-checkbox-with-select-all-buttons/" title="Delete Multiple Records Using Checkbox With Select All Buttons">Delete Multiple Records Using Checkbox With Select All Buttons</a></li>
<li><a href="http://www.jagadishwor.com.np/2009/08/php-mysql-deleting-multiple-records-using-checkbox/" title="PHP Mysql-Deleting multiple records using  checkbox  ">PHP Mysql-Deleting multiple records using  checkbox  </a></li>
<li><a href="http://www.jagadishwor.com.np/2010/02/php-array-functions/" title="PHP Array Functions">PHP Array Functions</a></li>
<li><a href="http://www.jagadishwor.com.np/2009/12/10-simple-php-login-sytem-tutorial/" title="10 Simple PHP Login Sytem Tutorial ">10 Simple PHP Login Sytem Tutorial </a></li>
<li><a href="http://www.jagadishwor.com.np/2009/12/css-style-for-cms-system/" title="CSS style for CMS system">CSS style for CMS system</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.jagadishwor.com.np/2009/11/php-mysql-own-cms-system-tutorial/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

<!-- www.000webhost.com Analytics Code -->
<script type="text/javascript" src="http://analytics.hosting24.com/count.php"></script>
<noscript><a href="http://www.hosting24.com/"><img src="http://analytics.hosting24.com/count.php" alt="web hosting" /></a></noscript>
<!-- End Of Analytics Code -->
