Hi friends,
I want to make my website's product-detail pages title dynamic. so help me how can i create this in php. please share your suggestion.
thanks.

Recommended Answers

All 3 Replies

Store the data in a database, and use $_GET[] to identify the URL page.

Connect to database and select and echo the $pageTitle

Alternatively, you can create a file called constants.php, and in that file, define th epage title like so;

<?php
define("PAGE_TITLE","My Title Page");    
?>

Include the page into the page where you wnt to display the title, like so;

<?php  
include('constants.php');

?>

Then, in the page where you want to add teh title, you insert the following code in the title section;

<title><?php echo PAGE_TITLE; ?></title>

That should work for you.

Like Squidge said. You are already accessing the database to display product information, so it shouldn't be difficult to add another column to contain productTitle information and inject it into the <title> tag.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.