I have this PHP code in one template (contact.html):
<?php
$on = 830;
$off = 1730;
$now = intval(date("Gi"));
echo "<!-- ".$now."-".$on."-".$off." -->";
if($now > $on && $now < $off) {
?>
<!-- the HTML I want to hide by time is located here -->
<?php
}
?>
and this code in another template (footer.html) that is embedded in the contact template above:
{if "{segment_1}" == "contact"}
<?php
$on = 0830;
$off = 1530;
$now = intval(date("Gi"));
echo "<!-- ".$now."-".$on."-".$off." -->";
if($now > $on && $now < $off) {
?>
<!-- the HTML I want to hide by time is located here -->
<?php
}
?>
{/if}
As you see, I echo out the values in both templates. When I load the page at 7:08am, I get this comment in the code for the contact template and the html is hidden just like planned:
<!-- 708-830-1730 -->
But in the code in the footer template, I get this comment and the html shows instead of being hidden:
<!-- 1208-830-1730 -->
Why the differences???