anyone, any ideas how to solve?
i get following error on a website:
Notice: Undefined variable: out in /var/sites/i/islandmemorials.co.uk/public_html/site/templates/includes/functions.php on line 43
and this is a code in that very functions file:
<?php
function numberOpen() {
date_default_timezone_set("Europe/London");
$currentHour = date('G');
if($currentHour > 9 && $currentHour < 21) {
$openFor = 21 - $currentHour;
if($openFor > 1) {
echo "We're currently open for another ".$openFor." hours, why not pop in?";
} else {
echo "Our lines are open for another hour - <a href=\"tel:+01983 857 600\">01983 857 600</a>";
}
} else {
echo "Unfortunately, our lines are currently closed, but you can still send a message below";
}
}
function getSubNav($pid) {
$test = wire('pages')->get("/services/");
$parents = wire('page')->parentID;
$template = wire('page')->template;
$out = '';
//echo "pid".$pid."<BR>";
//echo "parents".$parents."<BR>";
//echo "template".$template."<BR>";
$children = $test->children;
foreach($children as $child) {
$class = $child->id === $pid ? " active" : 'inactive';
if ($child->id === $pid ) {
$class= 'active';
}
elseif ($template= "memorials" && $child->id === $parents ) {
$class= 'active';
}
$out .= "<li><a class='{$class}' href='{$child->url}'>{$child->title}</a></li>";
}
return $out;
}
?>
i suppose this has to do with a variable scope, but not sure