bobo10 Posted August 30, 2008 Share Posted August 30, 2008 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 More sharing options...
BlueSkyIS Posted August 30, 2008 Share Posted August 30, 2008 you'll need to move the code so that the variables are declared first. p.s. it's dynamic Link to comment https://forums.phpfreaks.com/topic/122001-dynamatic-meta-tags/#findComment-629721 Share on other sites More sharing options...
bobo10 Posted August 30, 2008 Author Share Posted August 30, 2008 thats not possible.. any other way? Link to comment https://forums.phpfreaks.com/topic/122001-dynamatic-meta-tags/#findComment-629726 Share on other sites More sharing options...
BlueSkyIS Posted August 30, 2008 Share Posted August 30, 2008 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.