<?php $HourOfDay = '<script type="text/javascript"> var jetzt = new Date(); var x = jetzt.getHours(); if (x < 12) { greeting = "Good morning"; } else if (x < 20) { greeting = "Good afternoon"; } else { greeting = "Good evening"; } document.write(greeting) </script>'; echo $HourOfDay;
<?php /* CheckStatus snippet */ if (! $modx->user->hasSessionContext('web') ) { $modx->sendRedirect($modx->makeUrl(34)); }
This question has been answered by sottwell. See the first response.
return $HourOfDay;
Snippets should never echo, they should always return. Actually, a snippet will return in any case, but as you see, now if you don't give it something to return it will return 1 for success.
return $HourOfDay;