Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
PHP coding help needed
Old 10-31-2008, 04:54 PM PHP coding help needed
Junior Talker

Posts: 3
Name: mr
Trades: 0
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.

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!!
cashbagg is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-01-2008, 08:47 AM Re: PHP coding help needed
jito's Avatar
MY LIFE IS 'i' LIFE

Posts: 565
Name: surajit ray
Location: inside the heart of my friends
Trades: 0
PHP Code:
<?php
$filename 
$_SERVER['SCRIPT_NAME'];
$filename basename($filename);
?>
Add this code to header.
The $filename will return the current file name that's executing. You can use the $filename with some if-else to change the META and TITLE tag values.

Happy coding
__________________
I am not smart, that's why i don't act smart


Please login or register to view this content. Registration is FREE
jito is offline
Reply With Quote
View Public Profile
 
Old 11-01-2008, 04:47 PM Re: PHP coding help needed
Junior Talker

Posts: 3
Name: mr
Trades: 0
I have nearly zero PHP knowledge. If you could please tell me exactly what to add to my head.php, I'd be grateful.

I tried doing this (piecing together help from multiple sources)♠♠

<?php
$filename = $_SERVER['SCRIPT_NAME'];
$filename = basename($filename);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?=$video['title']?></title>
<meta name="robots" content="index, follow" />
<meta name="revisit-after" content="1 days" />
<meta name="keywords" content="<?=$video['tags']?> test, test" />


Please don't laugh too hard at my futile attempt. Can someone clean this up for me?
cashbagg is offline
Reply With Quote
View Public Profile
 
Old 11-01-2008, 04:55 PM Re: PHP coding help needed
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
I hate to sound like a dick, but if you have "nearly zero PHP" you really should hire someone to do you code for you or get a book on PHP.
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 11-01-2008, 05:04 PM Re: PHP coding help needed
Junior Talker

Posts: 3
Name: mr
Trades: 0
Rogem002, I don't see the point in you wasting yours and my time with useless replies such as this.

Obviously I could hire someone to do it. Instead I have chosen to ask around and see if I can get help with this by dipping into the VAST knowledge pool know as the World Wide Web...

This is a help forum for webmasters, is it not?

Well I'm asking politely for help, and your answer was anything but.
cashbagg is offline
Reply With Quote
View Public Profile
 
Old 11-01-2008, 05:50 PM Re: PHP coding help needed
mralokkp's Avatar
Average Talker

Posts: 16
Name: Alok Tiwari
Location: Ajmer,Rajasthan,India
Trades: 0
you can use this kinda appoach
http://www.daniweb.com/forums/thread83774.html

Don't copy and paste this. Get the concepts
Or
Use This method
Grab The Paga Main contains through DB. You had allready Got them. As you are displaying The page.Store in title variable And In title tage Display this with echo

This is the most simplyfied solution you can adopt utill you are comfortable with language.

--Regards
Alok Tiwari
India
mralokkp is offline
Reply With Quote
View Public Profile
 
Old 11-02-2008, 10:18 AM Re: PHP coding help needed
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
This is a help forum for webmasters, is it not?
Yep, A HELP forum not a replacement for tutorials or reference books.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-03-2008, 04:35 AM Re: PHP coding help needed
jito's Avatar
MY LIFE IS 'i' LIFE

Posts: 565
Name: surajit ray
Location: inside the heart of my friends
Trades: 0
If it is till unsolved:
PHP Code:
$filename $_SERVER['SCRIPT_NAME'];
$filename basename($filename);
if(
$filename == 'index.php'){
//put your META and TITLE here for index
}else if($filename == 'test.php'){
//put your META and TITLE here for test

Although the better approach will be to create a small CMS and store these values in DB.
__________________
I am not smart, that's why i don't act smart


Please login or register to view this content. Registration is FREE
jito is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to PHP coding help needed
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.85033 seconds with 12 queries