PDA

View Full Version : Dynamic Titles on CMS Website



sincere
07-30-2008, 08:08 AM
I have a website that has the ability to have dynamic titling but I've run into a roadblock. The code below works well if I just do if($page=='articles/view

The problem comes in when I try to include other areas that would benefit from a dynamic title like blogs, user profiles, question & answer, etc. Basically anything with a subject, title or username. Any input on this would be much appreciated.

This is implemented using a chunk object.

<?php
global $page, $pmi_DID, $AID;
$d = db();
if ($page == 'articles/view' 'blogs/view' 'homepages/view') {
$d->query("SELECT subject FROM articles WHERE DID='$pmi_DID' AND AID='$AID'");
$row = $d->fetch();
$title = $row['subject'] ['title'] '[fname] [lname]'];
}
else {
$title = "Film + Media + Publishing + Music + Technology + Entertainment ";
}
print "<title>" . $title . "&nbsp|&nbsp;Industry Grind Est. 2004&reg</title>";
?>

Nile
07-30-2008, 01:31 PM
Try this:


<?php
global $page, $pmi_DID, $AID;
$d = db();
if ($page == 'articles/view' || $page == 'blogs/view' || $page == 'homepages/view') {
$d->query("SELECT subject FROM articles WHERE DID='$pmi_DID' AND AID='$AID'");
$row = $d->fetch();
$title = $row['subject'] ['title'] '[fname] [lname]'];
}
else {
$title = "Film + Media + Publishing + Music + Technology + Entertainment ";
}
print "<title>" . $title . "&nbsp|&nbsp;Industry Grind Est. 2004&reg</title>";
?>