<?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>JamesMarquez.com &#187; PHP Snippets</title>
	<atom:link href="http://www.jamesmarquez.com/category/php-snippets/feed" rel="self" type="application/rss+xml" />
	<link>http://www.jamesmarquez.com</link>
	<description>filipino web applications developer and designer</description>
	<lastBuildDate>Sat, 29 May 2010 04:03:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PHP file reading error in Vista</title>
		<link>http://www.jamesmarquez.com/php-file-reading-error-in-vista.html</link>
		<comments>http://www.jamesmarquez.com/php-file-reading-error-in-vista.html#comments</comments>
		<pubDate>Thu, 15 Jan 2009 05:06:28 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[PHP Snippets]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Vista]]></category>
		<category><![CDATA[XAMPP]]></category>

		<guid isPermaLink="false">http://www.jamesmarquez.com/?p=20</guid>
		<description><![CDATA[I recently encountered this problem on Vista running localhost with XAMPP 1.7
I had this calendar script that loads a template from a given path, but it gives me a timeout error. It was previously running smoothly on an XP machine. After further checking, I found out that the problem was something related to the PHP [...]]]></description>
			<content:encoded><![CDATA[<p>I recently encountered this problem on Vista running localhost with XAMPP 1.7<br />
I had this calendar script that loads a template from a given path, but it gives me a timeout error. It was previously running smoothly on an XP machine. After further checking, I found out that the problem was something related to the PHP function file_get_contents, for sure this was not the problem as it is running okay on XP.</p>
<p>Here&#8217;s part of the script:</p>
<pre>function getCalendarTemplate($strPath)
{
    $content = file_get_contents($strPath);
    return $content;
}
</pre>
<p><span id="more-20"></span></p>
<p>After browsing and searching for some clue, I found with <a rel="nofollow" href="http://www.gaiaonline.com/forum/computers-technology/php-and-vista-are-making-me-go-nuts/t.42697373_1/">this forum</a> that using IP address instead of &#8220;localhost&#8221; on the path solved the problem. I&#8217;ve added extra line prior to file_get_content that replace the &#8220;localhost&#8221; into 127.0.01</p>
<p>Here&#8217;s the script now:</p>
<pre>function getCalendarTemplate($strPath)
{
    $strPath = str_replace('localhost', '127.0.0.1', $strPath);
    $content = file_get_contents($strPath);
    return $content;
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesmarquez.com/php-file-reading-error-in-vista.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to get the first date of the week in PHP?</title>
		<link>http://www.jamesmarquez.com/how-to-get-the-first-date-of-the-week-in-php.html</link>
		<comments>http://www.jamesmarquez.com/how-to-get-the-first-date-of-the-week-in-php.html#comments</comments>
		<pubDate>Mon, 21 Jul 2008 05:30:45 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[PHP Snippets]]></category>
		<category><![CDATA[code snippets]]></category>

		<guid isPermaLink="false">http://www.jamesmarquez.com/?p=8</guid>
		<description><![CDATA[To get the first date of the current week, you need subtract the numeric representation of the day of the week to the given date, in this case the current date.
The code will return the timestamp of the first date of the current date.

$timestamp = mktime(0, 0, 0, date('m'), date('d') - date('w'), date('Y'));

From the code [...]]]></description>
			<content:encoded><![CDATA[<p>To get the first date of the current week, you need subtract the numeric representation of the day of the week to the given date, in this case the current date.</p>
<p>The code will return the timestamp of the first date of the current date.<br />
<code><br />
$timestamp = mktime(0, 0, 0, date('m'), date('d') - date('w'), date('Y'));<br />
</code></p>
<p>From the code above, we can create functions that will return the first day of the week on any given date.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesmarquez.com/how-to-get-the-first-date-of-the-week-in-php.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
