- - Resolved buffer php
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 ...
<meta name="description" content="replace_this"/>
</html><?php ob_end_flush(); ?>
and... i was thinking about something like str_replace method or ... something like that...
What do you say and if somebody know how to do it i would appreciate code example :P thx
||12-10-2012 04:06 PM
Buffer contents can be extracted using the ob_get_contents method. You can then use replace_this as the search criteria.
$contents = ob_get_contents();
$contents = str_replace('replace_this', 'New Description', $contents);
Although I'd suggest it would be easier to simply use a variable to represent the description instead.
||12-10-2012 04:34 PM
Originally Posted by Trki
i need this meta description set with data from the middle part of website so ...
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.
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.
|All times are GMT +1. The time now is 08:30 AM.
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.