Iam not used to PHP, but after a little research i came to the following way to output a PHP Variable inside HTML (in my case its an h1 element)
if($current_month != $old_date) {
$test = the_date( 'F' );
echo '<h1>'.$test.'</h1>';
unfortunately, when i look in the outcoming html scource Code it looks like this :
TEST <"h1"> <"/h1">
so "TEST" should be inside my h1 element but its actually outside.
Anyone got an Explanation or an Idea what i do wrong?
thx in regard
3
Answers
If you look at the parameters,
the_date
will usually echo the date immediately unless you tell it otherwise. So instead, you need to pass in all of the parameters, and passecho
as false.hi you must at first close your if by } and then do this
and i think maybe you
Try this:
Or