Hi i am in situation when i want to have different descriptions for certain pages.... and i need this meta description set with data from the middle part of website so ...
and... i was thinking about something like str_replace method or ... something like that...
<meta name="description" content="replace_this"/>
</html><?php ob_end_flush(); ?>
What do you say and if somebody know how to do it i would appreciate code example :P thx
Buffer contents can be extracted using the ob_get_contents method. You can then use replace_this as the search criteria.
Although I'd suggest it would be easier to simply use a variable to represent the description instead.
$contents = ob_get_contents();
$contents = str_replace('replace_this', 'New Description', $contents);
To be honest, you would be better off running your php logic FIRST and then putting the generated variables into your template at the end and printing it out.
Originally Posted by Trki
It will save you a lot of hassle in the long run :thumbsup:
Thx a lot i was trying this myself but it still felt somewhere... i think the problem was that i didnt used ob_end_clean but i used of_flush or something like that.
Thx a lot guys.