Forum Moderators: coopster

Message Too Old, No Replies

PHP Beginner - Creating Unique Page Titles Using PHP

How do I create unique page titles using php?

         

recordc48

9:23 pm on Feb 17, 2004 (gmt 0)

10+ Year Member



Sorry, this is probably so simple, but i recently took over a .php site from a friend and I am just a beginner.

The site is calling content from a database, and I am wondering how to have the Meta Title match the topic of the page. Currently every single page has the same title. I want each page to have a unique title. For example, let's say the following page is about "cats".
[example.com...]
Is there a simple code to put on the products.php page to have the meta title be called "cats" and so on and so on...?

Here is the code that is currently on products.php

<title><?php echo $sitename;?><title>

Any help? Sorry if this is Basic

Birdman

9:34 pm on Feb 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You will have to look in the database for a column that contains a description of the page. If there is none, you will have to create a new column for the title and then manually add them to the database.

See if the host provides phpMyAdmin, it's an easy to use tool to interact with dbs.

By the way, welcome to Webmaster World.

recordc48

10:13 pm on Feb 17, 2004 (gmt 0)

10+ Year Member



I think I have found the column that contains a description, and it has the correct description there, so do I change the code on the product.php page or do I have to make some change to the database? What changes do I make to this code on the product.php page?
<title><?php echo $sitename;?><title>

recordc48

10:19 pm on Feb 17, 2004 (gmt 0)

10+ Year Member



This might be more clear...

I would like my titles to be automatically generated just like the title of this webmasterworld.com page is titled:
"PHP Beginner - Creating Unique Page Titles Using PHP"
What would I put in the php <title> code to do this?

Birdman

10:50 pm on Feb 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Look in the file that creates the page and see if the PHP code that calls the db is above the <title> section. If it is not, you will have to either move the code up or create another specific db connection to get the title.