Forum Moderators: coopster

Message Too Old, No Replies

Metatags and Keyword

is there a script u can use to create them autom.

         

snuif

1:52 pm on Jan 16, 2004 (gmt 0)

10+ Year Member



Hi i was wondering wht lines or javascript can you add, so whenever i open a link on my site it will display it in the format as underneath.

title
keywords
metaname

and is there a way that it will automatically display or determine wht the best keywords are to be displayed.im using php

thks for your help

jatar_k

7:51 pm on Jan 16, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You could do this with a database of words for your site and pull them dynamically to create the tags in the proper format.

Are you meaning to do thid on live pages or use the generator and then paste them into your html pages?

snuif

3:40 pm on Jan 17, 2004 (gmt 0)

10+ Year Member



hi thks for the reply

no on live pages, eacht time that a link is opened it should automatically creat the title etc, and search its self for the right correct kewords to be displayed.Im not sure if it is possible but i have seen some pages on this forum using the same kind of script and i have seen it on others as well i just dont know wht kind of script it is.........

cheers

httpwebwitch

8:44 pm on Jan 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Create a database table (call it "metadata") with the following fields:

URL ¦ Title ¦ Metakeywords

For each page on your site, enter the URL, title and keywords you'd like that page to use (key words separated by commas!)

Then in your page template, add this script:


<?php
$result=mysql_query("SELECT * FROM metadata WHERE URL='".$HTTP_SERVER_VARS['url']."'");
?>

That will look in your database for the record that matches the URL of the page being requested.

Then use that to print out your stuff:


<?php
$row=mysql_fetch_array($result);
print("<title>".$row['Title']."</title>");
print("<meta name='keywords' content='>".$row['Metakeywords']."'>");
?>