Page 1 of 1

Dynamic page title based on URL variables?

Posted: Wed Dec 14, 2005 3:05 pm
by zander213
I am setting the title for a drupal site of mine with the following script:

<?php
drupal_set_title($_GET['Foo1'].' '.$_GET['Foo2'].' '.$_GET['Foo3']);
?>

that's working just fine... but I want to include some additional text in the title like this:

"search.php?Foo1=Bar1&Foo2=Bar2&Foo3=Bar3" ... title would be "Bar1 Bar2 Bar3 TEXT"

How can I insert additional text into this output? Can I put an echo in here somehow?

Posted: Wed Dec 14, 2005 3:07 pm
by evilmonkey

Code: Select all

$title =$_GET['Foo1'].' '.$_GET['Foo2'].' '.$_GET['Foo3']."some of your own text";
echo $title;

Posted: Wed Dec 14, 2005 9:36 pm
by Jenk

Code: Select all

<?php

$title = (isset($_GET['foo']) ? htmlentities($_GET['foo']) : '');

?>
<html>
<head>
  <title>
  <?php echo $title; ?>
  </title>
</head>

 etc..