Saturday, 31 August 2013

Is it okay to set title and meta description in php like this?

Is it okay to set title and meta description in php like this?

I'm setting page title and meta description dynamically on the pages of my
site http://jobfou.com, since http is stateless, like this.
<html>
<?php
ob_start();
?>
<title> <!--TITLE--> </title>
<body>
Some HTML Page Content From Database Goes Here.
<?php
//The PHP Code Here Gets executed on each page loads, dynamically.
$wholePageContents = ob_get_contents();
$post_title = "Page 1";
ob_end_clean();
echo str_replace("<!--TITLE-->", $post_title, $wholePageContents);
?>
</body>
<html>
Is it okay to set page title and meta description like this, calling
ob_start(); on each page load, what are the pros and cons, or should i
just go with using jquery. Which is better, and doesn't consume memory.

No comments:

Post a Comment