am new to php
any one know about to display dynamic title per pageand also to display meta keywords and description.how to do that please give some idea or you have any codes share with me

4 Years
Discussion Span
Last Post by malatamil

You can change the title by setting 'document.title'.

To change the <meta> tags, you'll probably have to use document.getElementsByTagName('meta') and check the 'name' attribute for 'description' and 'keywords', but I can't think of any reason why you'd ever want to do it with JavaScript. Neither users nor the search engines are ever going to notice.


thanks for your response and sorry for asking. post some example code so that i will understand somewhat..


You're asking about php, but you've posted to js?

Before anybody spends any appreciable time giving an 'example', show any code that you've tried and how you want it to work.


for this particular pages i need

<li><a href="about_us.php?abtid=2" title="About Us" onclick="function changetab();">About Us</a></li> 
              <li><a href="contact_us.php" title="Contact Us">Contact Us</a></li> 
              <li><a href="faq.php?abtid=4" title="FAQ">FAQ</a></li> 
              <li><a href="terms_of_use.php" title="Terms Of Use">Terms Of Use</a></li> 

$abtid = $_SESSION['abtid'];

$sql1 = mysql_query("SELECT st.`id`,st.Catagory, st.`title`, st.`description`, st.`keywords`,sft.id,sft.titles FROM `seo_title` st JOIN seo_footer_title sft ON sft.id=st.Catagory WHERE st.Catagory='$abtid'");
$result = mysql_fetch_array($sql1);
    echo"hhh". $result['titles'];
    echo $result['description'];
    echo $result['keywords'];

<?php   //}
?> </title>
<meta id="mtlink" name="url" content="">
<meta id="mtdesc" name="description" content="<?php echo $result['description']; ?>" />
<meta id="mtkwrds" name="keywords" content="<?php echo $result['keywords']; ?>" />
<?php } ?>

but in this am getting only url for that pages

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.