Click to See Complete Forum and Search --> : Database Driven Page Titles


bajanboost
08-28-2006, 01:06 AM
I am calling a field from a database called "Description" which is vchar limited to 15 Characters.

I would like to be able to Have the Page title of my website dynamic so that every result displayed has a different page title when I click on that result for more details.

I have tried:

echo'<title>Website Name. :: '.$row[description].' </title>';


<title>Website Name. ::<? echo $oneprop->description; ?></title>

But Have failed. Any advise?

ronverdonk
08-28-2006, 05:09 AM
I am calling a field from a database called "Description" which is vchar limited to 15 Characters.

I would like to be able to Have the Page title of my website dynamic so that every result displayed has a different page title when I click on that result for more details.

I have tried:

echo'<title>Website Name. :: '.$row[description].' </title>';


<title>Website Name. ::<? echo $oneprop->description; ?></title>

But Have failed. Any advise?

Code $row array item within quotes $row['description'].

Ronald :cool:

pcthug
08-28-2006, 05:22 AM
Can we please see your database query.

katten
08-28-2006, 05:31 AM
To make the code some what cleaner you can use

<title>Website Name. ::<?= $oneprop->description; ?></title>

instead of

<title>Website Name. ::<? echo $oneprop->description; ?></title>

NogDog
08-28-2006, 11:02 AM
To make the code some what cleaner you can use

<title>Website Name. ::<?= $oneprop->description; ?></title>

instead of

<title>Website Name. ::<? echo $oneprop->description; ?></title>

Actually, for optimal code portability, you should avoid using either short tag form and use the full <?php tag:

<title>Website Name. :: <?php echo $oneprop->description; ?></title>

This avoids any problems with servers where short tags are not enabled, which is probably going keep being more common so as to avoid confusion with xml declarations.