I echoing the contents of a table using foreach, the problem I am getting is the date is always at the top of the page, so when looking at my one line preview I just get the date and nothing more. If I remove the date it is fine and you can see the first line of the template. So I am trying to remove the date tag from the preview using for each.
I am using the following code, but it doesnt seem to be doing a lot, as far as I can see I have things right ?.
echo '<div class="messagerow">';
// this pulls the message from the foreach above it
$emlmsg = $row->emailformmessage;
// I am trying to remove the date by replacing it with the blank contents of this string value.
$dateremove = '';
// This is the str_replace that is supposed to remove the {date} tag along with the paragraph tags it is wrapped in.
$emlmsgfiltered = str_replace(array('<p>{date}</p>'), array($dateremove), $emlmsg);
// I then echo the filtered message here, minus the date....but its still there ??
echo $emlmsgfiltered;
echo '</div>';
Edit >>>>>>
As requested, this is the html code
<p>{date}</p>
<p>Dear {name} thankyou for your order, if you need any more oil we will be happy to provide you with a competitive quote.</p>
<p>Kind Regards</p>
{createdby}
sorry . should have been an ansewr, not a comment:
why the array around the first value in str_replace()? are you supposed to be referencing an array element