<?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>andPHP.com &#187; Functions</title>
	<atom:link href="http://www.andphp.com/category/functions/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.andphp.com</link>
	<description>Web Development Tips, Tricks &#38; Much More</description>
	<lastBuildDate>Tue, 06 Apr 2010 19:41:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Update Copyright Year WITHOUT using PHP</title>
		<link>http://www.andphp.com/2010/01/26/update-copyright-year-without-using-php/</link>
		<comments>http://www.andphp.com/2010/01/26/update-copyright-year-without-using-php/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 21:52:58 +0000</pubDate>
		<dc:creator>Luiz</dc:creator>
				<category><![CDATA[Functions]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[copyright]]></category>
		<category><![CDATA[dynamic]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://www.andphp.com/?p=74</guid>
		<description><![CDATA[I&#8217;m going to show you how to automatically update the copyright year of your website without the use of PHP.  I have been seeing a lot of posts about, how to update the copyright notice of your website using PHP&#8217;s date() function.  What about those people whose websites are not PHP Diven? 
Well, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m going to show you how to automatically update the copyright year of your website without the use of PHP.  I have been seeing a lot of <a href="http://www.thewebsqueeze.com/tips-and-tricks/never-update-your-copyright-again-php.html" title="Did you remember to manually update your copyright statement to 2010?" target="_blank">posts</a> about, how to update the copyright notice of your website using PHP&#8217;s <a href="http://us3.php.net/manual/en/function.date.php" target="_blank" rel="nofollow" title="Format a local time/date">date()</a> function.  What about those people whose websites are not PHP Diven? </p>
<p>Well, you can do something very similar using JavaScript.  All you need is access to your HTML files. </p>
<h2>Writing the Display Copyright Function</h2>
<p>We are going to write a Javascript function that will output <em>Copyright &copy; [current year]</em>. Where [current year] is &#8230; you guessed it, the current year.</p>
<pre class="brush: javascript">
&lt;script type="text/javascript">
//&lt;![CDATA[
/**
 * Function looks for element whose id is copyright and
 * inserts a dynamic copyright notice with the current year
 */
	function DisplayCopyright(){
		var d = new Date();
		var e = document.getElementById("copyright");
		e.innerHTML = ("Copyright &copy; " + d.getFullYear());
}
 //]]&gt;
&lt;/script>
</pre>
<p><span id="more-74"></span></p>
<ul>
<li>This function instantiates a Date object.</li>
<li>Looks for the element whose id is equal to <strong>copyright</strong>.</li>
<li>Inserts a dynamic copyright notice with the current year, according to local time.</li>
</ul>
<h2> Placing the Copyright Element</h2>
<p>Now that we have the function that is going to dynamically generate the copyright notice. We need to add the element which will hold the copyright notice.</p>
<p>I&#8217;ll use a <strong>&lt;span&gt;</strong> element.</p>
<pre class="brush: html">
&lt;span id="copyright">&nbsp;&lt;/span>
</pre>
<p>You may place the above, wherever you want the copyright notice to be displayed.</p>
<h2>Making it Work</h2>
<p>Now that we have all of the separate pieces, it&#8217;s time to make it all function together.  You are going to need to call the <strong>DisplayCopyright</strong> function we have created earlier. One way to do this is by placing an <strong>window.onload</strong> following the function.</p>
<pre class="brush: javascript">
&lt;script type="text/javascript">
//&lt;![CDATA[
/**
 * Function looks for element whose id is copyright and
 * inserts a dynamic copyright notice with the current year
 */
	function DisplayCopyright(){
		var d = new Date();
		var e = document.getElementById("copyright");
		e.innerHTML = ("Copyright &copy; " + d.getFullYear());
}
//call DisplayCopyright when page finishes loading
window.onload = DisplayCopyright;
 //]]&gt;
&lt;/script>
</pre>
<p>There you have it, a non PHP way of dynamically updating the copyright notice of your website.  Keep in mind that if the user browser has JavaScript disabled, this particular solution will not work.  </p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.andphp.com/2009/10/29/jquery-contactable-plug-in-on-internet-explorer/" title="jQuery Contactable Plug-in on Internet Explorer">jQuery Contactable Plug-in on Internet Explorer</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.andphp.com/2010/01/26/update-copyright-year-without-using-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using debug_backtrace to speed up debuging process</title>
		<link>http://www.andphp.com/2008/02/29/using-debug_backtrace-to-speed-up-debuging-process/</link>
		<comments>http://www.andphp.com/2008/02/29/using-debug_backtrace-to-speed-up-debuging-process/#comments</comments>
		<pubDate>Fri, 29 Feb 2008 20:34:21 +0000</pubDate>
		<dc:creator>Luiz</dc:creator>
				<category><![CDATA[Functions]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[debug_backtrace]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.andphp.com/2008/02/29/using-debug_backtrace-to-speed-up-debuging-process/</guid>
		<description><![CDATA[Hasin Hayder from Developer Tutorials wrote this neat post about using debug_backtrace.   It could help you debug your code more efficiently and save you hours of dumping variables and testing functions, not to mention saving you from pulling your hair out.  I myself used it a couple of times when writing class [...]]]></description>
			<content:encoded><![CDATA[<p>Hasin Hayder from Developer Tutorials wrote this neat post about using <a href="http://us2.php.net/debug_backtrace" title="debug_backtrace" target="_blank">debug_backtrace</a>.   It could help you debug your code more efficiently and save you hours of dumping variables and testing functions, not to mention saving you from pulling your hair out.  I myself used it a couple of times when writing class files and such, it helps you read the code a little better too.  Go ahead and check out his post and leave a comment.</p>
<p><a href="http://www.developertutorials.com/blog/php/debugging-php-code-using-debug_backtrace-58/" rel="bookmark" title="Permanent Link: Debugging PHP code using debug_backtrace"  target="_blank">Debugging PHP code using debug_backtrace</a></p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.andphp.com/2009/06/30/ibuldings-com-php-5-3-migrating-guide/" title="iBuldings.com PHP 5.3 Migrating Guide">iBuldings.com PHP 5.3 Migrating Guide</a></li><li><a href="http://www.andphp.com/2009/06/30/php-5-3-released/" title="PHP 5.3 Released">PHP 5.3 Released</a></li><li><a href="http://www.andphp.com/2008/03/04/resize-images-with-this-php-script/" title="Resize images with this PHP script">Resize images with this PHP script</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.andphp.com/2008/02/29/using-debug_backtrace-to-speed-up-debuging-process/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
