cashbagg Posted October 31, 2008 Share Posted October 31, 2008 Hi, I have a embedded video website comprised of a main page, with header (head.php). Head.php contains the usual meta info on top. Ex: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>blah blah</title> <meta name="robots" content="index, follow" /> <meta name="revisit-after" content="1 days" /> <meta name="keywords" content="blah blah" /> <meta name="description" content="blah blah " /> The title and keywords on head.php are static when on main page, which is fine with me. Here's my problem/question: When I were to click one of my movie thumbs from the main page, it opens up a viewer page called view_video.php. This page contains a unique title of the video, along with tags (keywords). I want to be able to have the video title appear in <title>blah blah</title> and the tags appear in <meta name="keywords" content="blah blah" />. The title/tags come from mysql database. This way every video page has it's own unique title/keywords for the google bots to crawl. My site is adult, NSFW. I think you will need to view it's source in order to help me out. Please reply to this and I will PM you the URL to peruse, or the actual php files themselves. thanks. Link to comment https://forums.phpfreaks.com/topic/130899-php-coding-help-needed/ Share on other sites More sharing options...
peranha Posted October 31, 2008 Share Posted October 31, 2008 All you would need to do is echo out the variables from the database. <title><?php echo $variable; ?></title> <meta name="keywords" content="<?php echo $variable2; ?>" /> Link to comment https://forums.phpfreaks.com/topic/130899-php-coding-help-needed/#findComment-679474 Share on other sites More sharing options...
cashbagg Posted October 31, 2008 Author Share Posted October 31, 2008 Didn't work. I'm sure there is something additional I need to add to head.php to have it recognize this code somehow. But....I'm no coding pro that's for sure. Link to comment https://forums.phpfreaks.com/topic/130899-php-coding-help-needed/#findComment-679487 Share on other sites More sharing options...
peranha Posted October 31, 2008 Share Posted October 31, 2008 Did you select the values from the database first, then change $variable to the value, and $variable2 to the values Link to comment https://forums.phpfreaks.com/topic/130899-php-coding-help-needed/#findComment-679498 Share on other sites More sharing options...
cashbagg Posted October 31, 2008 Author Share Posted October 31, 2008 This should help, I've posted my code. head.php : http://pastebin.co.za/650 view_video.php : http://pastebin.co.za/651 Title is defined as: $video['title']; Tags defined as : $video['tags'] Hope someone can figure this one out! Thanks!! Link to comment https://forums.phpfreaks.com/topic/130899-php-coding-help-needed/#findComment-679507 Share on other sites More sharing options...
cashbagg Posted October 31, 2008 Author Share Posted October 31, 2008 Did you select the values from the database first That I didn't do...and I'm not sure how to. I did rename them though when I inserted them. Link to comment https://forums.phpfreaks.com/topic/130899-php-coding-help-needed/#findComment-679510 Share on other sites More sharing options...
peranha Posted October 31, 2008 Share Posted October 31, 2008 You would do something like <?php // Create query to select title and tags $query = "SELECT title, tags FROM table WHERE video = '$video'"; // Query the database $result = mysql_query($query) or die mysql_error(); // Get the data. $row = mysql_fetch_row($result); // This will get the title echo $row[0]; // This will get the tags echo $row[1]; ?> Link to comment https://forums.phpfreaks.com/topic/130899-php-coding-help-needed/#findComment-679522 Share on other sites More sharing options...
cashbagg Posted October 31, 2008 Author Share Posted October 31, 2008 Sorry...I'm really new at this stuff...so hopefully I don't sound too dumb. I inserted that code exactly as u posted it into head.php, and it caused site to load a blank page. I restored it...it's fine...but what am I doing incorrect? Link to comment https://forums.phpfreaks.com/topic/130899-php-coding-help-needed/#findComment-679534 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.