<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Smoking Linux &#187; PHP Tutorials</title>
	<atom:link href="http://www.smokinglinux.com/category/php-tutorials/feed" rel="self" type="application/rss+xml" />
	<link>http://www.smokinglinux.com</link>
	<description>Exchange your Linux experience with us</description>
	<lastBuildDate>Wed, 01 Feb 2012 06:14:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Dynamic PDF creation with PHP &#8211; Very Easy</title>
		<link>http://www.smokinglinux.com/php-tutorials/dynamic-pdf-creation-with-php-very-easy</link>
		<comments>http://www.smokinglinux.com/php-tutorials/dynamic-pdf-creation-with-php-very-easy#comments</comments>
		<pubDate>Thu, 22 Nov 2007 21:14:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP Tutorials]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[dynamic]]></category>
		<category><![CDATA[fpdf]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php4]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[phpclass]]></category>
		<category><![CDATA[sample]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.smokinglinux.com/php-tutorials/dynamic-pdf-creation-with-php-very-easy</guid>
		<description><![CDATA[FPDF is a PHP class which allows to create PDF files with PHP. The advantage is that PDFlib requires a fee for a commercial usage. F from FPDF stands for Free: So yu can use this class to generate PDFs for free and modify source code for your needs. You must use this class if [...]]]></description>
			<content:encoded><![CDATA[<p>FPDF is a PHP class which allows to create PDF files with PHP. The advantage is that PDFlib requires a fee for a commercial usage. F from FPDF stands for Free: So yu can use this class to generate PDFs for free and modify source code for your needs.</p>
<p>You must use this class if you want create PDF content directly from PHP to implement for example download of your site content in PDF dinamically. You can download it and see how it works in the sample code below.</p>
<p><span id="more-893"></span></p>
<p><a href="http://www.fpdf.org/">Download FPDF </a></p>
<blockquote><p>Sample <a href="http://cloneforest.com">PHP Script</a>:<br />
&lt; ?php<br />
require(&#8216;fpdf.php&#8217;);</p>
<p>class PDF extends FPDF<br />
{<br />
function Header()<br />
{<br />
$this-&gt;Image(â€™logo.jpgâ€™,10,10,190);<br />
$this-&gt;SetFont(â€™Arialâ€™,&#8217;Bâ€™,15);<br />
$this-&gt;Cell(80);<br />
$this-&gt;Ln(20);<br />
}<br />
}<br />
$pdf=new PDF();<br />
$pdf-&gt;AliasNbPages();<br />
$pdf-&gt;AddPage();<br />
$pdf-&gt;SetFont(â€™Helveticaâ€™,â€,12);<br />
$pdf-&gt;Image(â€™../Images/photos/â€™.$line[â€™Codeâ€™].â€™.jpgâ€™,56.8,119.9,103.6,72.5);<br />
$pdf-&gt;Image(â€™../Images/clipart/â€™.$line[â€™Codeâ€™].â€™.jpgâ€™,56.8,197.9,103.6,72.5);</p>
<p>$pdf-&gt;Ln(46);<br />
$pdf-&gt;Cell(47);<br />
$pdf-&gt;Cell(0,10,CODOEM.â€™: â€˜.$line[â€™Descriptionâ€™],0,1);<br />
$pdf-&gt;Cell(47);<br />
$pdf-&gt;Cell(0,10,CODMA.â€™: â€˜.$line[â€™Codeâ€™],0,1);<br />
$pdf-&gt;Cell(47);<br />
$pdf-&gt;Cell(0,10,BRAND.â€™: â€˜.$line[â€™categoryâ€™],0,1);<br />
$pdf-&gt;Output();<br />
?&gt;</p></blockquote>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><em>Submit to:</em><br /><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.smokinglinux.com/php-tutorials/dynamic-pdf-creation-with-php-very-easy&amp;title=Dynamic+PDF+creation+with+PHP+%26%238211%3B+Very+Easy" title="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a Del.icio.us"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a Del.icio.us" alt="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a Del.icio.us" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.smokinglinux.com/php-tutorials/dynamic-pdf-creation-with-php-very-easy&amp;title=Dynamic+PDF+creation+with+PHP+%26%238211%3B+Very+Easy" title="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a digg"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a digg" alt="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a digg" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://furl.net/storeIt.jsp?t=Dynamic+PDF+creation+with+PHP+%26%238211%3B+Very+Easy&amp;u=http://www.smokinglinux.com/php-tutorials/dynamic-pdf-creation-with-php-very-easy" title="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a FURL"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/furl.png" title="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a FURL" alt="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a FURL" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.smokinglinux.com/php-tutorials/dynamic-pdf-creation-with-php-very-easy" title="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a Technorati"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a Technorati" alt="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a Technorati" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://www.smokinglinux.com/php-tutorials/dynamic-pdf-creation-with-php-very-easy&amp;t=Dynamic+PDF+creation+with+PHP+%26%238211%3B+Very+Easy" title="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a Yahoo My Web"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a Yahoo My Web" alt="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a Yahoo My Web" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://www.smokinglinux.com/php-tutorials/dynamic-pdf-creation-with-php-very-easy&amp;title=Dynamic+PDF+creation+with+PHP+%26%238211%3B+Very+Easy" title="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a Stumble Upon"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a Stumble Upon" alt="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a Stumble Upon" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.smokinglinux.com/php-tutorials/dynamic-pdf-creation-with-php-very-easy&amp;title=Dynamic+PDF+creation+with+PHP+%26%238211%3B+Very+Easy" title="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a Google Bookmarks"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a Google Bookmarks" alt="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a Google Bookmarks" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?title=Dynamic+PDF+creation+with+PHP+%26%238211%3B+Very+Easy&amp;url=http://www.smokinglinux.com/php-tutorials/dynamic-pdf-creation-with-php-very-easy" title="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a SlashDot"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/slashdot.png" title="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a SlashDot" alt="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a SlashDot" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://www.smokinglinux.com/php-tutorials/dynamic-pdf-creation-with-php-very-easy&amp;t=Dynamic+PDF+creation+with+PHP+%26%238211%3B+Very+Easy" title="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a FaceBook"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a FaceBook" alt="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a FaceBook" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home?status=http://www.smokinglinux.com/php-tutorials/dynamic-pdf-creation-with-php-very-easy" title="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a Twitter"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/twitter.png" title="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a Twitter" alt="Add 'Dynamic PDF creation with PHP &#8211; Very Easy' a Twitter" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.smokinglinux.com/php-tutorials/dynamic-pdf-creation-with-php-very-easy/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW</title>
		<link>http://www.smokinglinux.com/php-tutorials/php-simple-authentication-script-with-php_auth_user-and-php_auth_pw</link>
		<comments>http://www.smokinglinux.com/php-tutorials/php-simple-authentication-script-with-php_auth_user-and-php_auth_pw#comments</comments>
		<pubDate>Sun, 18 Nov 2007 14:06:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP Tutorials]]></category>
		<category><![CDATA[$_server]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[header()]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php4]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[php_auth]]></category>
		<category><![CDATA[php_auth_pw]]></category>
		<category><![CDATA[php_auth_user]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[www]]></category>

		<guid isPermaLink="false">http://www.smokinglinux.com/php-tutorials/php-simple-authentication-script-with-php_auth_user-and-php_auth_pw</guid>
		<description><![CDATA[In this howto, we can create a little PHP authentication system with only few rows of PHP code. We can use header() function to submit the &#8220;Authentication Required&#8221; Message to the client browser, so on client browser we can see a dialog popup that require Username and Password. When we fill the fields, we can [...]]]></description>
			<content:encoded><![CDATA[<p>In this howto, we can create a little PHP authentication system with only few rows of PHP code. We can use header() function to submit the &#8220;Authentication Required&#8221; Message to the client browser, so on client browser we can see a dialog popup that require Username and Password. When we fill the fields, we can receive variables through arrays: <strong>&#8220;$_SERVER: PHP_AUTH_USER&#8221;</strong> and <strong>&#8220;$_SERVER: PHP_AUTH_PW&#8221;</strong>. We can use this simple authentication system only if PHP runtime is installed as Apache module.</p>
<p>Now we can see how it works through the source code:</p>
<p><span id="more-891"></span></p>
<blockquote><p>&lt;?php</p>
<p>#We have to specify username and password for authentication<br />
$user = &#8220;userdemo&#8221;;<br />
$pass = &#8220;passdemo&#8221;;</p>
<p>#We ask to open a popup of Authentication System on the client browser<br />
if (!isset($_SERVER['PHP_AUTH_USER']))<br />
{<br />
header(&#8220;WWW-Authenticate: Basic realm=\&#8221;You must Log In!\&#8221;");<br />
Header(&#8220;HTTP/1.0 401 Unauthorized&#8221;);<br />
exit;<br />
}<br />
#We have to verify is Login User and Password are the same of defined variables<br />
else if (($_SERVER['PHP_AUTH_USER'] == $user) &amp;&amp; ($_SERVER['PHP_AUTH_PW'] == $pass))<br />
{<br />
echo &#8220;Now you are Logged In&#8221;;<br />
}<br />
#If Login not is correct<br />
else<br />
{<br />
echo &#8220;Error!&#8221;;<br />
}<br />
?&gt;</p></blockquote>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><em>Submit to:</em><br /><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.smokinglinux.com/php-tutorials/php-simple-authentication-script-with-php_auth_user-and-php_auth_pw&amp;title=PHP+%26%238211%3B+Simple+authentication+script+with+PHP_AUTH_USER+and+PHP_AUTH_PW" title="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a Del.icio.us"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a Del.icio.us" alt="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a Del.icio.us" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.smokinglinux.com/php-tutorials/php-simple-authentication-script-with-php_auth_user-and-php_auth_pw&amp;title=PHP+%26%238211%3B+Simple+authentication+script+with+PHP_AUTH_USER+and+PHP_AUTH_PW" title="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a digg"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a digg" alt="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a digg" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://furl.net/storeIt.jsp?t=PHP+%26%238211%3B+Simple+authentication+script+with+PHP_AUTH_USER+and+PHP_AUTH_PW&amp;u=http://www.smokinglinux.com/php-tutorials/php-simple-authentication-script-with-php_auth_user-and-php_auth_pw" title="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a FURL"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/furl.png" title="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a FURL" alt="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a FURL" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.smokinglinux.com/php-tutorials/php-simple-authentication-script-with-php_auth_user-and-php_auth_pw" title="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a Technorati"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a Technorati" alt="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a Technorati" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://www.smokinglinux.com/php-tutorials/php-simple-authentication-script-with-php_auth_user-and-php_auth_pw&amp;t=PHP+%26%238211%3B+Simple+authentication+script+with+PHP_AUTH_USER+and+PHP_AUTH_PW" title="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a Yahoo My Web"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a Yahoo My Web" alt="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a Yahoo My Web" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://www.smokinglinux.com/php-tutorials/php-simple-authentication-script-with-php_auth_user-and-php_auth_pw&amp;title=PHP+%26%238211%3B+Simple+authentication+script+with+PHP_AUTH_USER+and+PHP_AUTH_PW" title="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a Stumble Upon"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a Stumble Upon" alt="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a Stumble Upon" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.smokinglinux.com/php-tutorials/php-simple-authentication-script-with-php_auth_user-and-php_auth_pw&amp;title=PHP+%26%238211%3B+Simple+authentication+script+with+PHP_AUTH_USER+and+PHP_AUTH_PW" title="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a Google Bookmarks"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a Google Bookmarks" alt="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a Google Bookmarks" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?title=PHP+%26%238211%3B+Simple+authentication+script+with+PHP_AUTH_USER+and+PHP_AUTH_PW&amp;url=http://www.smokinglinux.com/php-tutorials/php-simple-authentication-script-with-php_auth_user-and-php_auth_pw" title="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a SlashDot"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/slashdot.png" title="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a SlashDot" alt="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a SlashDot" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://www.smokinglinux.com/php-tutorials/php-simple-authentication-script-with-php_auth_user-and-php_auth_pw&amp;t=PHP+%26%238211%3B+Simple+authentication+script+with+PHP_AUTH_USER+and+PHP_AUTH_PW" title="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a FaceBook"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a FaceBook" alt="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a FaceBook" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home?status=http://www.smokinglinux.com/php-tutorials/php-simple-authentication-script-with-php_auth_user-and-php_auth_pw" title="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a Twitter"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/twitter.png" title="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a Twitter" alt="Add 'PHP &#8211; Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW' a Twitter" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://www.smokinglinux.com/php-tutorials/php-simple-authentication-script-with-php_auth_user-and-php_auth_pw/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code</title>
		<link>http://www.smokinglinux.com/php-tutorials/auto-ajax-update-your-old-php-pages-in-ajax-including-a-simple-class-in-your-php-code</link>
		<comments>http://www.smokinglinux.com/php-tutorials/auto-ajax-update-your-old-php-pages-in-ajax-including-a-simple-class-in-your-php-code#comments</comments>
		<pubDate>Fri, 09 Nov 2007 19:20:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP Tutorials]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[automatic]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[post]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[simple]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.smokinglinux.com/php-tutorials/auto-ajax-update-your-old-php-pages-in-ajax-including-a-simple-class-in-your-php-code</guid>
		<description><![CDATA[What is Auto Ajax? Auto Ajax is a PHP Class written by Cesar D. Rodas. Surely you had seen many Ajax website that work without browser refresh. If you want implement this function in your php projects, this PHP Class is perfect for you. In fact I&#8217;ve test personally this class updating only parts of [...]]]></description>
			<content:encoded><![CDATA[<p><strong>What is Auto Ajax?</strong></p>
<p>Auto Ajax is a PHP Class written by Cesar D. Rodas. Surely you had seen many Ajax website that work without browser refresh. If you want implement this function in your php projects, this PHP Class is perfect for you. In fact I&#8217;ve test personally this class updating only parts of php code.</p>
<p><span id="more-878"></span></p>
<p>PHP Class structure of Auto Ajax use some Javascripts to see when user click on the current page links. When user do a click, PHP Class make an Ajax POST request to update only specific section of the page. Another important thing that make it a cross-browser compatible, is when user browser don&#8217;t support Ajax or Javascript, so Auto Ajax will be disabled automatically and your links will show as normal HTML links without Ajax feature.</p>
<p><a href="http://cesars.users.phpclasses.org/browse/package/4211/download/targz.html" target="_blank">Download from here</a></p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><em>Submit to:</em><br /><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.smokinglinux.com/php-tutorials/auto-ajax-update-your-old-php-pages-in-ajax-including-a-simple-class-in-your-php-code&amp;title=Auto+Ajax+%26%238211%3B+Update+your+old+PHP+pages+in+Ajax+including+a+simple+class+in+your+PHP+Code" title="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a Del.icio.us"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a Del.icio.us" alt="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a Del.icio.us" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.smokinglinux.com/php-tutorials/auto-ajax-update-your-old-php-pages-in-ajax-including-a-simple-class-in-your-php-code&amp;title=Auto+Ajax+%26%238211%3B+Update+your+old+PHP+pages+in+Ajax+including+a+simple+class+in+your+PHP+Code" title="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a digg"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a digg" alt="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a digg" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://furl.net/storeIt.jsp?t=Auto+Ajax+%26%238211%3B+Update+your+old+PHP+pages+in+Ajax+including+a+simple+class+in+your+PHP+Code&amp;u=http://www.smokinglinux.com/php-tutorials/auto-ajax-update-your-old-php-pages-in-ajax-including-a-simple-class-in-your-php-code" title="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a FURL"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/furl.png" title="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a FURL" alt="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a FURL" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.smokinglinux.com/php-tutorials/auto-ajax-update-your-old-php-pages-in-ajax-including-a-simple-class-in-your-php-code" title="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a Technorati"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a Technorati" alt="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a Technorati" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://www.smokinglinux.com/php-tutorials/auto-ajax-update-your-old-php-pages-in-ajax-including-a-simple-class-in-your-php-code&amp;t=Auto+Ajax+%26%238211%3B+Update+your+old+PHP+pages+in+Ajax+including+a+simple+class+in+your+PHP+Code" title="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a Yahoo My Web"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a Yahoo My Web" alt="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a Yahoo My Web" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://www.smokinglinux.com/php-tutorials/auto-ajax-update-your-old-php-pages-in-ajax-including-a-simple-class-in-your-php-code&amp;title=Auto+Ajax+%26%238211%3B+Update+your+old+PHP+pages+in+Ajax+including+a+simple+class+in+your+PHP+Code" title="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a Stumble Upon"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a Stumble Upon" alt="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a Stumble Upon" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.smokinglinux.com/php-tutorials/auto-ajax-update-your-old-php-pages-in-ajax-including-a-simple-class-in-your-php-code&amp;title=Auto+Ajax+%26%238211%3B+Update+your+old+PHP+pages+in+Ajax+including+a+simple+class+in+your+PHP+Code" title="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a Google Bookmarks"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a Google Bookmarks" alt="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a Google Bookmarks" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?title=Auto+Ajax+%26%238211%3B+Update+your+old+PHP+pages+in+Ajax+including+a+simple+class+in+your+PHP+Code&amp;url=http://www.smokinglinux.com/php-tutorials/auto-ajax-update-your-old-php-pages-in-ajax-including-a-simple-class-in-your-php-code" title="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a SlashDot"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/slashdot.png" title="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a SlashDot" alt="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a SlashDot" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://www.smokinglinux.com/php-tutorials/auto-ajax-update-your-old-php-pages-in-ajax-including-a-simple-class-in-your-php-code&amp;t=Auto+Ajax+%26%238211%3B+Update+your+old+PHP+pages+in+Ajax+including+a+simple+class+in+your+PHP+Code" title="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a FaceBook"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a FaceBook" alt="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a FaceBook" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home?status=http://www.smokinglinux.com/php-tutorials/auto-ajax-update-your-old-php-pages-in-ajax-including-a-simple-class-in-your-php-code" title="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a Twitter"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/twitter.png" title="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a Twitter" alt="Add 'Auto Ajax &#8211; Update your old PHP pages in Ajax including a simple class in your PHP Code' a Twitter" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://www.smokinglinux.com/php-tutorials/auto-ajax-update-your-old-php-pages-in-ajax-including-a-simple-class-in-your-php-code/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Aggiungere un Editor WYSIWYG (visuale) nel proprio sito</title>
		<link>http://www.smokinglinux.com/php-tutorials/aggiungere-un-editor-wysiwyg-visuale-nel-proprio-sito</link>
		<comments>http://www.smokinglinux.com/php-tutorials/aggiungere-un-editor-wysiwyg-visuale-nel-proprio-sito#comments</comments>
		<pubDate>Mon, 30 Jul 2007 16:12:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP Tutorials]]></category>

		<guid isPermaLink="false">http://www.smokinglinux.com/php-tutorials/aggiungere-un-editor-wysiwyg-visuale-nel-proprio-sito</guid>
		<description><![CDATA[Trasforma il tuo sito in PHP o quello dei tuoi clienti in un CMS! La possibilitÃ  di editare il contenuto dei tuoi siti in modo visuale Ã¨ piÃ¹ semplice di quanto pensi, e questo tutorial ti guiderÃ  verso la realizzazione di questo sistema in tre semplici passaggi. Mai piÃ¹ aggiornamenti dei contenuti editando l&#8217;HTML e [...]]]></description>
			<content:encoded><![CDATA[<p align="center"><img src="http://www.smokinglinux.com/wp-content/uploads/2007/07/wysiwyg2.gif" alt="wysiwyg2.gif" /></p>
<p align="left">Trasforma il tuo sito in PHP o quello dei tuoi clienti in un CMS! La possibilitÃ  di editare il contenuto dei tuoi siti in modo visuale Ã¨ piÃ¹ semplice di quanto pensi, e questo tutorial ti guiderÃ  verso la realizzazione di questo sistema in tre semplici passaggi. Mai piÃ¹ aggiornamenti dei contenuti editando l&#8217;HTML e caricando i files tramite FTP. Potrai editare le tue pagine direttamente tramite browser da qualunque posto ti trovi. Una dimostrazione online Ã¨ reperibile tramite <a href="http://teamwishbone.com/demos/wysiwyg" target="_blank">QUESTO LINK</a>.</p>
<p align="left">Questo tutorial riassume alcuni aspetti fondamentali su come separare il design del sito dal contenuto e aggiungendo un editor che consentirÃ  al proprietario del sito, l&#8217;editing dei contenuti da qualunque punto d&#8217;accesso. Questo tutorial Ã¨ redatto per l&#8217;utilizzo del PHP, ma le stesse tecniche possono essere tradotte con linguaggi tipo ASP, Perl-CGI e altri linguaggi di programmazione per il web.</p>
<p align="left">Questo tutorial presuppone che si abbiano le seguenti conoscenze:</p>
<ul>
<li>HTML</li>
<li>Programmazione base in PHP</li>
<li>Invio Forms tramite POST</li>
<li>Query di Stringhe ($_GET)</li>
</ul>
<p align="left">Questo tutorial si dividerÃ  in:</p>
<ul>
<li>Separazione dell&#8217;header e del footer dalle proprie pagine</li>
<li>Creazione di un template per il contenuto della pagina</li>
<li>Aggiungere un editor WYSIWYG in JavaScript</li>
</ul>
<p align="left">Nel tutorial trattato utilizzeremo TinyMCE come editor JavaScript. Questa utility in JavaScript s&#8217;integra facilmente in una qualsiasi campo/oggetto HTML denominato &#8220;textarea&#8221;, consentendo all&#8217;utente un&#8217;editing del contenuto stile MS Word. Con una minima conoscenza di JavaScript Ã¨ possibile configurare l&#8217;editor in base alle proprie esigenze, aggiungendo nuovi pulsanti e caratteristiche aggiuntive. Tra le caratteristiche giÃ  incluse nell&#8217;editor vediamo la possibilitÃ  di editare il conenuto a tutto schermo e la creazione di tabelle.</p>
<p align="left"><strong>Parte 1 &#8211; Separazione dell&#8217;header e del footer dalle proprie pagine</strong></p>
<p align="left">Molti di voi avranno giÃ  praticato questa tecnica. La chiave di questa tecnica Ã¨ la semplicitÃ  di gestione del sito creando files che contengano l&#8217;HTML per l&#8217;header (parte superiore del sito) e il footer (parte inferiore del sito) della pagina. L&#8217;header solitamente contiente il Banner/Logo, i Links di Navigazione e elementi come tabelle o tag DIV che impostino parte della tua pagina. Il footer invece, chiude tutti i TAG precedentemente aperti nell&#8217;header, quindi se ad esempio nell&#8217;header abbiamo inserito &lt;table&gt;, nel footer procederemo inserendo &lt;/table&gt; e cosÃ¬ via. Inoltre spesso il footer viene utilizzato per l&#8217;inserimento del copyright o le informazioni riguardante il creatore del sito. Se attualmente il vostro sito in PHP utilizza questa tecnica, Ã¨ possibile saltare questa parte di tutorial.</p>
<p align="left">Esempio di header:</p>
<blockquote><p>header.html</p>
<p>===========<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;!&#8211; Head stuff goes here. &#8211;&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;</p>
<p>&lt;div style=&#8221;width: 800px&#8221;&gt;</p>
<p>&lt;!&#8211; Header Image &#8211;&gt;<br />
&lt;img src=&#8221;header.jpg&#8221; /&gt;&lt;br /&gt;</p>
<p>&lt;!&#8211; Navigation &#8211;&gt;<br />
&lt;p style=&#8221;text-align: center&#8221;&gt;<br />
&lt;a href=&#8221;link1.php&#8221;&gt;Link 1&lt;/a&gt; |<br />
&lt;a href=&#8221;link2.php&#8221;&gt;Link 2&lt;/a&gt; |<br />
&lt;a href=&#8221;link3.php&#8221;&gt;Link 3&lt;/a&gt; |<br />
&lt;a href=&#8221;link4.php&#8221;&gt;Link 4&lt;/a&gt;<br />
&lt;/p&gt;</p></blockquote>
<p class="code">&nbsp;</p>
<p align="left">Notare come i tag DIV, BODY o HTML non sono stati chiusi. Questo verrÃ  fatto nel footer.</p>
<p align="justify">Esempio di footer:</p>
<p class="code">&nbsp;</p>
<blockquote><p> footer.html</p></blockquote>
<blockquote><p> ===========<br />
&lt;/div&gt;<br />
&lt;p style=&#8221;text-align: center&#8221;&gt;Site created by &lt;a href&#8221;http://www.smokinglinux.com&#8221;&gt;Smoking Linux&lt;/a&gt;&lt;/p&gt;<br />
&lt;/html&gt;</p></blockquote>
<p align="left">Vi starete domandando: &#8220;Com&#8217;Ã¨ possibile  fare tutto ciÃ²?&#8221;. Date uno sguardo allo script che segue:</p>
<p class="code">&nbsp;</p>
<blockquote><p> index.php</p></blockquote>
<blockquote><p> ===========<br />
&lt;?php<br />
include(&#8220;header.html&#8221;);</p>
<p>// Il contenuto va qui.</p>
<p>include(&#8220;footer.html&#8221;);<br />
?&gt;</p></blockquote>
<p align="left">Se si decide di utilizzare questo codice per ogni pagina, vi accorgerete come sia piÃ¹ facile mantenere un sito web. Se infatti si decide di cambiare il design dell&#8217;intero sito, andrete a modificare esclusivamente il file header.html e non sarete costretti a modificare ogni singola pagina html  del vostro sito web.</p>
<p align="left"><strong>Parte 2 &#8211; Creazione di un template per il contenuto della pagina</strong></p>
<p align="left">A questo punto, molte pagine del vostro sito risulteranno identiche eccetto per il contenuto. Ci troviamo ad avere per ogni pagina in PHP del nostro sito, un &#8220;include&#8221; per il piazzamento dell&#8217;header, uno spazio dove inserire il contenuto e un &#8220;include&#8221; per il piazzamento del footer. Questo potrebbe andare bene se il contenuto del nostro sito sia non piÃ¹ di 10-20 pagine, ma se iniziassimo ad avere centinaia di pagine di contenuto? Il trucco sta nell&#8217;avere una sola pagina di contenuto e una molteplicitÃ  di files &#8220;txt&#8221;, uno per ogni pagina, dove inserire il contenuto e editarlo successivamente tramite l&#8217;editor visuale in JavaScript.</p>
<blockquote>
<p align="justify">Esempio di File &#8220;txt&#8221; per il contenuto:</p>
<p> news.txt<br />
===========<br />
&lt;h1 align=&#8221;center&#8221;&gt;News&lt;/h1&gt;<br />
&lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.&lt;/p&gt;<br />
&lt;p&gt;Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.&lt;/p&gt;</p></blockquote>
<p class="code">&nbsp;</p>
<p align="left">Com&#8217;Ã¨ possibile utilizzarlo nel nostro sito? Semplicemente attraverso una query di stringhe che chiedano al nostro script in PHP quale contenuto si vuole visualizzare. Per esempio: http://tuosito.com/?page=news. Pertanto osservate il nostro nuovo file index.php come dovrÃ  apparire:</p>
<blockquote><p>index.php<br />
===========<br />
&lt;?php<br />
include(&#8216;header.html&#8217;);</p>
<p>// Set $page to &#8220;home.txt&#8221; if a parameter isn&#8217;t passed<br />
if ($_GET['page']) {<br />
$page = $_GET['page'] . &#8216;.txt&#8217;;<br />
} else {<br />
$page = &#8216;home.txt&#8217;;<br />
}</p>
<p>// Check to see if file exists and include it in.<br />
if (file_exists(&#8220;pages/$page&#8221;)) {<br />
include(&#8220;pages/$page&#8221;);</p>
<p>// If page doesn&#8217;t exist, give an error message.<br />
} else {<br />
echo(&#8220;&lt;h1 align=\&#8221;center\&#8221;&gt;Page cannot be found&lt;/h1&gt;\n&#8221;);<br />
}</p>
<p>include(&#8216;footer.html&#8217;);<br />
?&gt;</p></blockquote>
<p class="code">&nbsp;</p>
<p align="left">Un&#8217;altra importante caratteristica da aggiungere dovrebbe essere la navigazione del contenuto nel caso in cui decideste di dividere il contenuto in piÃ¹ pagine, quindi aggiungendo il links &#8220;Previous&#8221; (precedente) e &#8220;Next&#8221;. Il prossimo blocco di testo potrebbe essere aggiunto dopo &#8220;include(&#8220;pages/$page&#8221;)&#8217;. Questo controllerÃ  per un nome di file che termini con _page(number).  Se ci sono altri nomi di files che terminano con _page(number-1) e/o _page(number+1), esso includerÃ  i links: &#8220;Previous Page&#8221; (pagina precedente) e &#8220;Next Page&#8221; (pagina successiva) nella parte inferiore della pagina.</p>
<p class="code">&nbsp;</p>
<blockquote><p> if (preg_match(&#8220;/^(.*_page)(\d+)/&#8221;, $page], $matches)) {<br />
$prev_page = $matches[2] &#8211; 1;<br />
$next_page = $matches[2] + 1;<br />
echo(&#8220;&lt;p style=\&#8221;text-align: center\&#8221;&gt;&#8221;);<br />
if (file_exists(&#8220;pages/&#8221; . $matches[1] . $prev_page . &#8220;.php&#8221;)) {<br />
echo(&#8220;&lt;a href=\&#8221;{$_SERVER['PHP_SELF']}&#8221; .<br />
&#8220;?page={$matches[1]}$prev_page\&#8221;&gt;Previous Page&lt;/a&gt;&#8221;);<br />
$prev = 1;<br />
}<br />
if (file_exists(&#8220;pages/&#8221; . $matches[1] . $next_page . &#8220;.php&#8221;)) {<br />
if ($prev) {<br />
echo(&#8220;Â Â Â Â Â Â &#8221;);<br />
}<br />
echo(&#8220;&lt;a href=\&#8221;{$_SERVER['PHP_SELF']}&#8221; .<br />
&#8220;?page={$matches[1]}$next_page\&#8221;&gt;Next Page&lt;/a&gt;&#8221;);<br />
}<br />
echo(&#8220;&lt;/p&gt;&#8221;);<br />
}</p></blockquote>
<p align="left"><strong>Parte 3 &#8211; Aggiungere un editor WYSIWYG in JavaScript</strong></p>
<p align="left">Questa parte di tutorial riassume come inserire l&#8217;editor JavaScript per l&#8217;editazione delle pagine. Ovviamente la parte di amministrazione e modifica delle pagine dovrebbe essere fuori dalla portata del visitatore e quindi dobbiamo creare un&#8217;area protetta tramite .htaccess per la directory che chiameremo &#8220;secure&#8221;. E&#8217; possibile chiedere al provider per l&#8217;abilitazione di tale servizio. Se la creazione dell&#8217;area sicura verrÃ  effettuata correttamente vi troverete a dover digitare nome utente e password in un box di autenticazione quando tenterete l&#8217;accesso all&#8217;indirizzo: http://tuosito.com/secure/?page=nomepagina.</p>
<p align="left">Siccome lo script proposto risulterÃ  un tantino piÃ¹ esteso del precente, lo tratteremo in sezioni.</p>
<blockquote>
<p align="left"> secure/index.php<br />
============<br />
&lt;?php<br />
include(&#8220;../header.html&#8221;);</p>
<p>// Get the page name from the query string<br />
$page = $_GET['page'] . &#8216;.txt&#8217;;</p>
<p>if (!$_GET['page']) {<br />
echo(&#8220;&lt;h1&gt;Page name not specified&lt;/h1&gt;\n&#8221;);<br />
include(&#8220;../footer.html&#8221;);<br />
exit;<br />
}</p></blockquote>
<p align="left">Questo Ã¨ molto simile al precedente script. Accertiamoci perÃ² che in questo caso, ci troviamo nella directory &#8220;secure&#8221;. Procediamo quindi con la stesura del codice:</p>
<blockquote>
<p align="left">if ($_POST['page']) {<br />
$handle = fopen(&#8220;../pages/$page&#8221;, &#8216;a&#8217;);<br />
fwrite( $handle, $_POST['page']);<br />
fclose($handle);<br />
echo($_POST['page']);<br />
include(&#8220;../footer.html&#8221;);<br />
exit;<br />
}</p></blockquote>
<p align="left">In questo modo il nostro editor ci consente l&#8217;editing, e lo stesso script processerÃ  il risultato. Questo passaggio controllerÃ  se noi abbiamo inserito il contenuto. Se abbiamo inserito contenuti nella nostra pagine, esso apre il file indicato nel nome della query di stringhe, lo scrive, chiude il file, mostra il nuovo contenuto del file, carica il footer ed esce.</p>
<p class="code">&nbsp;</p>
<blockquote><p> if (file_exists(&#8220;../pages/$page&#8221;)) {<br />
$FILE = fopen(&#8220;../pages/$page&#8221;, &#8220;rt&#8221;);<br />
while (!feof($FILE)) {<br />
$text .= fgets($FILE);<br />
}<br />
fclose($FILE);<br />
} else {<br />
echo(&#8220;&lt;h1&gt;New Page: $page&lt;/h1&gt;\n&#8221;);<br />
$text = &#8220;&lt;p&gt;&lt;/p&gt;&#8221;;<br />
}</p></blockquote>
<p>Questo invece Ã¨ un po&#8217; piÃ¹ complicato. Se abbiamo specificato una pagina che esiste, legge il file e lo carica nella variabile $text. Se la pagina non esiste, presuppone che ne vogliamo creare una nuova e inserisce all&#8217;inizio della pagina un paragrafo vuoto tramite i tag (&lt;p&gt;&lt;/p&gt;). La prossima parte di codice caricherÃ  il nostro editor JavaScript TinyMCE. E&#8217; necessario inoltre prestare attenzione al percorso inserito che dovrÃ  puntare a TinyMCE, quindi la directory dove avrete caricato i files di TinyMCE precedentemente scaricati.</p>
<p class="code">&nbsp;</p>
<blockquote><p> echo &lt;&lt;&lt; EOM<br />
&lt;script language=&#8221;javascript&#8221; type=&#8221;text/javascript&#8221; src=&#8221;/tinymce/jscripts/tiny_mce/tiny_mce.js&#8221;&gt;&lt;/script&gt;<br />
&lt;script language=&#8221;javascript&#8221; type=&#8221;text/javascript&#8221;&gt;<br />
tinyMCE.init({<br />
mode : &#8220;textareas&#8221;,<br />
theme : &#8220;advanced&#8221;,<br />
theme_advanced_toolbar_location : &#8220;top&#8221;,<br />
theme_advanced_toolbar_align : &#8220;left&#8221;,<br />
theme_advanced_path_location : &#8220;bottom&#8221;<br />
});<br />
&lt;/script&gt;<br />
EOM;</p></blockquote>
<p>Solitamente inseriamo il nostro JavaScript all&#8217;interno dei tag &lt;head&gt; della nostra pagina. Ma &lt;head&gt; Ã¨ caricato attraverso il file header.html e siccome non abbiamo intenzione di caricare il nostro codice in ogni pagina, ma esclusivamente quando amministriamo i contenuti, inseriremo lo script all&#8217;interno dei tag &lt;body&gt;. Nel sito web di TinyMCE, troverete tantissime risorse su come configurare e personalizzare il vostro editor. Lo scopo del nostro tutorial invece Ã¨ quello di porre le basi per il corretto funzionamento dello stesso all&#8217;interno del codice PHP.</p>
<p class="code">&nbsp;</p>
<blockquote><p> $this_page = $_SERVER['PHP_SELF'];<br />
$query_string = $_SERVER['QUERY_STRING'];<br />
echo(&#8220;&lt;form method=\&#8221;post\&#8221; action=\&#8221;$this_page$query_string\&#8221;&gt;\n&#8221;);<br />
echo(&#8220;&lt;textarea id=\&#8221;page\&#8221; name=\&#8221;page\&#8221; rows=25 cols=80&gt;\n&#8221;);<br />
echo(htmlspecialchars($text));<br />
echo(&#8220;&lt;/textarea&gt;\n&#8221;);<br />
echo(&#8220;&lt;input type=\&#8221;submit\&#8221; value=\&#8221;Save\&#8221;&gt;\n&#8221;);<br />
echo(&#8220;&lt;/form&gt;\n&#8221;);</p></blockquote>
<p>Questa parte di codice crea il form, la textarea e il bottone &#8220;Save&#8221; (salva). La funzione &#8220;htmlspecialchars($text)&#8221; richiama la variabile $text, e sostituisce tutti i caratteri speciali con i codici HTML per i caratteri speciali. CosÃ¬ il vostro file non presenterÃ  errori quando visualizzato nella pagina. L&#8217;output di questa funzione verrÃ  passato alla textarea. Quando il bottone &#8220;Save&#8221; verrÃ  premuto, esso ricaricherÃ  nuovamente la stessa pagina con la stessa query di stringhe, ma questa volta troverÃ  del contenuto inviato. Questo Ã¨ inviato alla seconda sezione di codice all&#8217;inizio di questa pagina dove verrÃ  salvato il file.</p>
<p>include(&#8220;../footer.html&#8221;);<br />
?&gt;</p>
<p>QuestÃ  Ã¨ la parte finale del nostro codice che chiuderÃ  tutti i tag precedentemente aperti attraverso il caricamento del footer.</p>
<p>E&#8217; possibile scaricare il file compresso contenente i files dell&#8217;intero tutorial da <a href="http://teamwishbone.com/downloads/wysiwyg.zip">QUI</a>.</p>
<p>Il presente tutorial Ã¨ una traduzione offerta da smokinglinux.com, la fonte originale Ã¨ reperibile <a href="http://teamwishbone.com/?mode=viewpage&amp;item=javascript_php_editor_page1" target="_blank">QUI</a>.</p>
<p align="left">&nbsp;</p>
<p align="justify">&nbsp;</p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><em>Submit to:</em><br /><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.smokinglinux.com/php-tutorials/aggiungere-un-editor-wysiwyg-visuale-nel-proprio-sito&amp;title=Aggiungere+un+Editor+WYSIWYG+%28visuale%29+nel+proprio+sito" title="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a Del.icio.us"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a Del.icio.us" alt="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a Del.icio.us" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.smokinglinux.com/php-tutorials/aggiungere-un-editor-wysiwyg-visuale-nel-proprio-sito&amp;title=Aggiungere+un+Editor+WYSIWYG+%28visuale%29+nel+proprio+sito" title="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a digg"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a digg" alt="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a digg" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://furl.net/storeIt.jsp?t=Aggiungere+un+Editor+WYSIWYG+%28visuale%29+nel+proprio+sito&amp;u=http://www.smokinglinux.com/php-tutorials/aggiungere-un-editor-wysiwyg-visuale-nel-proprio-sito" title="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a FURL"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/furl.png" title="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a FURL" alt="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a FURL" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.smokinglinux.com/php-tutorials/aggiungere-un-editor-wysiwyg-visuale-nel-proprio-sito" title="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a Technorati"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a Technorati" alt="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a Technorati" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://www.smokinglinux.com/php-tutorials/aggiungere-un-editor-wysiwyg-visuale-nel-proprio-sito&amp;t=Aggiungere+un+Editor+WYSIWYG+%28visuale%29+nel+proprio+sito" title="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a Yahoo My Web"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a Yahoo My Web" alt="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a Yahoo My Web" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://www.smokinglinux.com/php-tutorials/aggiungere-un-editor-wysiwyg-visuale-nel-proprio-sito&amp;title=Aggiungere+un+Editor+WYSIWYG+%28visuale%29+nel+proprio+sito" title="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a Stumble Upon"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a Stumble Upon" alt="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a Stumble Upon" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.smokinglinux.com/php-tutorials/aggiungere-un-editor-wysiwyg-visuale-nel-proprio-sito&amp;title=Aggiungere+un+Editor+WYSIWYG+%28visuale%29+nel+proprio+sito" title="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a Google Bookmarks"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a Google Bookmarks" alt="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a Google Bookmarks" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?title=Aggiungere+un+Editor+WYSIWYG+%28visuale%29+nel+proprio+sito&amp;url=http://www.smokinglinux.com/php-tutorials/aggiungere-un-editor-wysiwyg-visuale-nel-proprio-sito" title="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a SlashDot"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/slashdot.png" title="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a SlashDot" alt="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a SlashDot" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://www.smokinglinux.com/php-tutorials/aggiungere-un-editor-wysiwyg-visuale-nel-proprio-sito&amp;t=Aggiungere+un+Editor+WYSIWYG+%28visuale%29+nel+proprio+sito" title="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a FaceBook"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a FaceBook" alt="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a FaceBook" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home?status=http://www.smokinglinux.com/php-tutorials/aggiungere-un-editor-wysiwyg-visuale-nel-proprio-sito" title="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a Twitter"><img src="http://www.smokinglinux.com/wp-content/plugins/social-bookmarking-reloaded/twitter.png" title="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a Twitter" alt="Add 'Aggiungere un Editor WYSIWYG (visuale) nel proprio sito' a Twitter" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://www.smokinglinux.com/php-tutorials/aggiungere-un-editor-wysiwyg-visuale-nel-proprio-sito/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

