Help Generating Dynamic Page Titles
Posted: Sun Nov 01, 2009 8:43 pm
I am having trouble figuring out the best way to implement dynamic page titles within my site. Currently, my header file looks like this:
And within the site pages I have defined
However I have a categories.php that the 30 or so categories are pulled from, so I need a new way of generating the titles since the pages are all generated from this one file.
At the top of the categories.php the database connection file is included along with the header and to display the given category, the id is defined:
And if this helps, the category lists are generated later with the following:
Any ideas on what would be the easiest way for me to get this working?
Thanks
Code: Select all
<title><?php if(isset($title)) { print $title; } else { print "other title goes here"; } ?></title>Code: Select all
$title "unique page title here"
At the top of the categories.php the database connection file is included along with the header and to display the given category, the id is defined:
Code: Select all
$id=$_REQUEST['id'];Code: Select all
<?
$servcat=mysql_query("select * from We_ServiceCategory_tbl ");
if(mysql_num_rows($servcat)>0)
{
while($rscat=mysql_fetch_assoc($servcat))
{
?>
<a href="categories.php?id=<? echo $rscat['Category_Id'];?>" ><? echo htmlentities($rscat['Category_text']);?></a>Thanks