<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: PHP Tide Clock</title>
	<atom:link href="http://www.dawhoo.com/php-tide-clock/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dawhoo.com/php-tide-clock/</link>
	<description>a little this a little that</description>
	<lastBuildDate>Fri, 09 Jul 2010 12:20:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: admin</title>
		<link>http://www.dawhoo.com/php-tide-clock/comment-page-1/#comment-19364</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Sat, 12 Jun 2010 18:27:24 +0000</pubDate>
		<guid isPermaLink="false">http://dawhoo.com/blog/2008/01/19/php-tide-clock/#comment-19364</guid>
		<description>ooooh, I will have to check that out!  I like how you deal with the day ahead - nice!</description>
		<content:encoded><![CDATA[<p>ooooh, I will have to check that out!  I like how you deal with the day ahead &#8211; nice!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stelmo</title>
		<link>http://www.dawhoo.com/php-tide-clock/comment-page-1/#comment-19344</link>
		<dc:creator>stelmo</dc:creator>
		<pubDate>Mon, 03 May 2010 21:33:07 +0000</pubDate>
		<guid isPermaLink="false">http://dawhoo.com/blog/2008/01/19/php-tide-clock/#comment-19344</guid>
		<description>// Based on this script I made this one. It needs some changes to show the exacts hours in 
//each day, but its a begining

 &lt;?php 
header(&#039;Content-Type: text/html; charset=utf-8&#039;);

function mostrar_form()
{
echo &quot;&quot;;
echo &quot;Month:&quot;;
echo &quot;&quot;;
echo &quot;Year:&quot;;
echo &quot;&quot;;
echo &quot;&quot;;
echo &quot;&quot;; 

}

// Here you can translate the name of the months
function mes($m)
{ 
	 switch($m){ 
		 case &quot;January&quot;: return &quot;Janeiro&quot;; break; 
		 case &quot;February&quot;: return &quot;Fevereiro&quot;; break; 
		 case &quot;Mars&quot;: return &quot;Março&quot;; break;
		 case &quot;April&quot;: return &quot;Abril&quot;; break; 
		 case &quot;May&quot;: return &quot;Maio&quot;; break; 
		 case &quot;June&quot;: return &quot;Junho&quot;; break;
		 case &quot;July&quot;: return &quot;Julho&quot;; break;
		 case &quot;August&quot;: return &quot;Agosto&quot;; break;
		 case &quot;September&quot;: return &quot;Setembro&quot;; break;
		 case &quot;Octuber&quot;: return &quot;Outubro&quot;; break;
		 case &quot;November&quot;: return &quot;Novembro&quot;; break;
		 case &quot;December&quot;: return &quot;Dezembro&quot;; break;
	}
	
}

function processa_form($mes, $dia, $ano)
{
	$knowntide = strtotime(&#039;2010-04-28 03:00&#039;); //  Last known high tide–&gt;
	$current = date(&#039;U&#039;, mktime(0, 0, 0, $mes,$dia, $ano));
	$interval = (12 * 3600) + (21 * 60);  // 12 hours and 50 minutes between high tides–&gt;
	$num_tides_passed = floor(($current - $knowntide) / $interval);
	$last_tide = $knowntide + ($interval * $num_tides_passed);
	$next_high = $last_tide + $interval; // 12 hours and 50 minutes between 2 high tides –&gt;
	$next_low = $last_tide + (6 * 3600) + (17 * 60); // 
		
	echo date(&#039;G:i&#039;, $next_low),&quot; Baixa-Mar &quot;; // low tide
	echo date(&#039;G:i&#039; , $next_high),&quot; Preia-Mar &quot;;//high tide
	echo date(&#039;G:i&#039; , $next_low + $interval),&quot; Baixa-Mar &quot;;
	echo date(&#039;G:i&#039; , $next_high + $interval),&quot; Preia-Mar &quot;; 
}


mostrar_form();

if (empty($_POST[&#039;mes&#039;])){
	$date =time () ;
}
else
{
	$month_year=$_POST[&#039;mes&#039;].&quot;/1/&quot;.$_POST[&#039;ano&#039;];
	$date=strtotime($month_year);
}

//This gets today&#039;s date


//This puts the day, month, and year in seperate variables
$day = date(&#039;d&#039;, $date) ;
$month = date(&#039;m&#039;, $date) ;
$year = date(&#039;Y&#039;, $date) ;

//Here we generate the first day of the month
$first_day = mktime(0,0,0,$month, 1, $year) ;


//This gets us the month name
$title = date(&#039;F&#039;, $first_day) ; 

//Here we find out what day of the week the first day of the month falls on 
 $day_of_week = date(&#039;D&#039;, $first_day) ; 

 //Once we know what day of the week it falls on, we know how many blank days occure before it. If the first day of the week is a Sunday then it would be zero
 switch($day_of_week){ 
 case &quot;Sun&quot;: $blank = 0; break; 
 case &quot;Mon&quot;: $blank = 1; break; 
 case &quot;Tue&quot;: $blank = 2; break; 
 case &quot;Wed&quot;: $blank = 3; break; 
 case &quot;Thu&quot;: $blank = 4; break; 
 case &quot;Fri&quot;: $blank = 5; break; 
 case &quot;Sat&quot;: $blank = 6; break; 
 }

 //We then determine how many days are in the current month
 $days_in_month = cal_days_in_month(0, $month, $year) ; 

 //Here we start building the table heads 
 echo &quot;&quot;;
 echo &quot; &quot;, mes($title), &quot; $year &quot;;
 echo &quot;DomingoSegundaTerçaQuartaQuintaSextaSábado&quot;;

 //This counts the days in the week, up to 7
 $day_count = 1;

 echo &quot;&quot;;
 //first we take care of those blank days
 while ( $blank &gt; 0 ) 
 { 
 echo &quot; &quot;; 
 $blank = $blank-1; 
 $day_count++; 
 } 

//sets the first day of the month to 1 
 $day_num = 1;

 //count up the days, untill we&#039;ve done all of them in the month
 while ( $day_num &lt;= $days_in_month ) 
 { 
	echo &quot;&quot;; 
	echo $day_num;
	echo &quot;&quot;; 
	echo &quot;&quot;;
	processa_form($month,$day_num, $year);
	echo &quot;&quot;;
	echo &quot;&quot;; 
	 $day_num++; 
	 $day_count++;

	 //Make sure we start a new row every week
	 if ($day_count &gt; 7)
	 {
		 echo &quot;&quot;;
		 $day_count = 1;
	 }
 } 

 //Finaly we finish out the table with some blank details if needed
 while ( $day_count &gt;1 &amp;&amp; $day_count &lt;=7 ) 
 { 
 echo &quot; &quot;; 
 $day_count++; 
 } 
 
 echo &quot;&quot;;</description>
		<content:encoded><![CDATA[<p>// Based on this script I made this one. It needs some changes to show the exacts hours in<br />
//each day, but its a begining</p>
<p> &lt;?php<br />
header(&#039;Content-Type: text/html; charset=utf-8&#039;);</p>
<p>function mostrar_form()<br />
{<br />
echo &quot;&#8221;;<br />
echo &#8220;Month:&#8221;;<br />
echo &#8220;&#8221;;<br />
echo &#8220;Year:&#8221;;<br />
echo &#8220;&#8221;;<br />
echo &#8220;&#8221;;<br />
echo &#8220;&#8221;; </p>
<p>}</p>
<p>// Here you can translate the name of the months<br />
function mes($m)<br />
{<br />
	 switch($m){<br />
		 case &#8220;January&#8221;: return &#8220;Janeiro&#8221;; break;<br />
		 case &#8220;February&#8221;: return &#8220;Fevereiro&#8221;; break;<br />
		 case &#8220;Mars&#8221;: return &#8220;Março&#8221;; break;<br />
		 case &#8220;April&#8221;: return &#8220;Abril&#8221;; break;<br />
		 case &#8220;May&#8221;: return &#8220;Maio&#8221;; break;<br />
		 case &#8220;June&#8221;: return &#8220;Junho&#8221;; break;<br />
		 case &#8220;July&#8221;: return &#8220;Julho&#8221;; break;<br />
		 case &#8220;August&#8221;: return &#8220;Agosto&#8221;; break;<br />
		 case &#8220;September&#8221;: return &#8220;Setembro&#8221;; break;<br />
		 case &#8220;Octuber&#8221;: return &#8220;Outubro&#8221;; break;<br />
		 case &#8220;November&#8221;: return &#8220;Novembro&#8221;; break;<br />
		 case &#8220;December&#8221;: return &#8220;Dezembro&#8221;; break;<br />
	}</p>
<p>}</p>
<p>function processa_form($mes, $dia, $ano)<br />
{<br />
	$knowntide = strtotime(&#8216;2010-04-28 03:00&#8242;); //  Last known high tide–&gt;<br />
	$current = date(&#8216;U&#8217;, mktime(0, 0, 0, $mes,$dia, $ano));<br />
	$interval = (12 * 3600) + (21 * 60);  // 12 hours and 50 minutes between high tides–&gt;<br />
	$num_tides_passed = floor(($current &#8211; $knowntide) / $interval);<br />
	$last_tide = $knowntide + ($interval * $num_tides_passed);<br />
	$next_high = $last_tide + $interval; // 12 hours and 50 minutes between 2 high tides –&gt;<br />
	$next_low = $last_tide + (6 * 3600) + (17 * 60); // </p>
<p>	echo date(&#8216;G:i&#8217;, $next_low),&#8221; Baixa-Mar &#8220;; // low tide<br />
	echo date(&#8216;G:i&#8217; , $next_high),&#8221; Preia-Mar &#8220;;//high tide<br />
	echo date(&#8216;G:i&#8217; , $next_low + $interval),&#8221; Baixa-Mar &#8220;;<br />
	echo date(&#8216;G:i&#8217; , $next_high + $interval),&#8221; Preia-Mar &#8220;;<br />
}</p>
<p>mostrar_form();</p>
<p>if (empty($_POST['mes'])){<br />
	$date =time () ;<br />
}<br />
else<br />
{<br />
	$month_year=$_POST['mes'].&#8221;/1/&#8221;.$_POST['ano'];<br />
	$date=strtotime($month_year);<br />
}</p>
<p>//This gets today&#8217;s date</p>
<p>//This puts the day, month, and year in seperate variables<br />
$day = date(&#8216;d&#8217;, $date) ;<br />
$month = date(&#8216;m&#8217;, $date) ;<br />
$year = date(&#8216;Y&#8217;, $date) ;</p>
<p>//Here we generate the first day of the month<br />
$first_day = mktime(0,0,0,$month, 1, $year) ;</p>
<p>//This gets us the month name<br />
$title = date(&#8216;F&#8217;, $first_day) ; </p>
<p>//Here we find out what day of the week the first day of the month falls on<br />
 $day_of_week = date(&#8216;D&#8217;, $first_day) ; </p>
<p> //Once we know what day of the week it falls on, we know how many blank days occure before it. If the first day of the week is a Sunday then it would be zero<br />
 switch($day_of_week){<br />
 case &#8220;Sun&#8221;: $blank = 0; break;<br />
 case &#8220;Mon&#8221;: $blank = 1; break;<br />
 case &#8220;Tue&#8221;: $blank = 2; break;<br />
 case &#8220;Wed&#8221;: $blank = 3; break;<br />
 case &#8220;Thu&#8221;: $blank = 4; break;<br />
 case &#8220;Fri&#8221;: $blank = 5; break;<br />
 case &#8220;Sat&#8221;: $blank = 6; break;<br />
 }</p>
<p> //We then determine how many days are in the current month<br />
 $days_in_month = cal_days_in_month(0, $month, $year) ; </p>
<p> //Here we start building the table heads<br />
 echo &#8220;&#8221;;<br />
 echo &#8221; &#8220;, mes($title), &#8221; $year &#8220;;<br />
 echo &#8220;DomingoSegundaTerçaQuartaQuintaSextaSábado&#8221;;</p>
<p> //This counts the days in the week, up to 7<br />
 $day_count = 1;</p>
<p> echo &#8220;&#8221;;<br />
 //first we take care of those blank days<br />
 while ( $blank &gt; 0 )<br />
 {<br />
 echo &#8221; &#8220;;<br />
 $blank = $blank-1;<br />
 $day_count++;<br />
 } </p>
<p>//sets the first day of the month to 1<br />
 $day_num = 1;</p>
<p> //count up the days, untill we&#8217;ve done all of them in the month<br />
 while ( $day_num &lt;= $days_in_month )<br />
 {<br />
	echo &quot;&#8221;;<br />
	echo $day_num;<br />
	echo &#8220;&#8221;;<br />
	echo &#8220;&#8221;;<br />
	processa_form($month,$day_num, $year);<br />
	echo &#8220;&#8221;;<br />
	echo &#8220;&#8221;;<br />
	 $day_num++;<br />
	 $day_count++;</p>
<p>	 //Make sure we start a new row every week<br />
	 if ($day_count &gt; 7)<br />
	 {<br />
		 echo &#8220;&#8221;;<br />
		 $day_count = 1;<br />
	 }<br />
 } </p>
<p> //Finaly we finish out the table with some blank details if needed<br />
 while ( $day_count &gt;1 &amp;&amp; $day_count &lt;=7 )<br />
 {<br />
 echo &quot; &#8220;;<br />
 $day_count++;<br />
 } </p>
<p> echo &#8220;&#8221;;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.dawhoo.com/php-tide-clock/comment-page-1/#comment-18076</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Sun, 26 Jul 2009 17:55:09 +0000</pubDate>
		<guid isPermaLink="false">http://dawhoo.com/blog/2008/01/19/php-tide-clock/#comment-18076</guid>
		<description>That is a complete example. Most of the time, a php_includes is used to call the function. Your hosting company may not have PHP enabled, which would be very rare. However, more often the case deleting the cache clears up the problem with PHP wanting to download rather than render.</description>
		<content:encoded><![CDATA[<p>That is a complete example. Most of the time, a php_includes is used to call the function. Your hosting company may not have PHP enabled, which would be very rare. However, more often the case deleting the cache clears up the problem with PHP wanting to download rather than render.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vince</title>
		<link>http://www.dawhoo.com/php-tide-clock/comment-page-1/#comment-18069</link>
		<dc:creator>Vince</dc:creator>
		<pubDate>Mon, 13 Jul 2009 01:22:18 +0000</pubDate>
		<guid isPermaLink="false">http://dawhoo.com/blog/2008/01/19/php-tide-clock/#comment-18069</guid>
		<description>Isn&#039;t a htm file is needed to make this work? 
When I click .php files from my website they will downloads to my home PC.
It would be helpful to show a complete example to viewers.</description>
		<content:encoded><![CDATA[<p>Isn&#8217;t a htm file is needed to make this work?<br />
When I click .php files from my website they will downloads to my home PC.<br />
It would be helpful to show a complete example to viewers.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
