Jump to content

dynamatic meta tags


bobo10

Recommended Posts

hello,

 

i have a problem, i want dynamatic meta tags and title on my website. the problem is the following:

 

 

my index.php have in the top of the page the meta-tags and the title.

 

in the middle of my index.php there is an include for my content pages. the content pages declares meta-keywords, meta-description and title. they are dynamatic and they are declared from data out of my database.

 

example:

 

index.php:

<?php
echo '<html><head>';
echo '<title>' . $title . '</title>';
echo '<meta name="description" content="' . $description . '">';
echo '<meta name="keywords" content="' . $keywords . '">';

echo '</head><body>';

//my tables and menu....

include('artists.php?id=5');


echo '</body></html>'

?>

 

artists.php:


<?php



$art_id = addslashes($_GET['id']);

$qry = mysql_query("SELECT * FROM tbl_artists WHERE art_id='$art_id'");

while ($row = mysql_fetch_assoc($qry)) {

$title = $row['art_name'];
$keywords = $row['art_name'] . ', ' . $row['art_country'] . ', ' . $row['art_genre'];
$description = $row['art_description];

}

echo 'content text blabla';
?>


 

this is not working ofcourse.. because the variables are not declared before they are written..

 

but i dont know how to fix this.. can someone help me?

 

 

thanks in advance.. (and sorry for my bad english;))

 

Link to comment
https://forums.phpfreaks.com/topic/122001-dynamatic-meta-tags/
Share on other sites

in the middle of my index.php there is an include for my content pages. the content pages declares meta-keywords, meta-description and title. they are dynamatic and they are declared from data out of my database.

 

cut out the part that declares metas and place that in it's own include, then include it at the top.

Link to comment
https://forums.phpfreaks.com/topic/122001-dynamatic-meta-tags/#findComment-629737
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.