#native_company# #native_desc#
#native_cta#

default title

By Dan
on November 8, 2001

After I learned of the ease with which I could use PHP to incorporate a template into my website I had to figure out how to make the title not be default in all my pages. Sure, there’s lots of site-building template packages that’ll do this but when I first learned PHP I didn’t know that (also I’m a control-freak and not truly happy unless I’ve designed the whole thing myself:)

This is actually my first ‘snippet’. Put this in the template (you figure out where it goes;)

<HTML>
 <HEAD>
  <TITLE>
   <? if ($TITLE == '') {print "DEFAULT TITLE SUITABLE FOR ANY PAGE";} else {print "$TITLE";}?>
  </TITLE>

.. then on any page that you don’t want the default title to appear put

<?$TITLE="THE SPECIAL TITLE FOR THIS PAGE ONLY";
INCLUDE ("TEMPLATE");

Maybe that’s pretty obvious, maybe everybody else is already doing that but it seems to me that I invented it and that makes me happy (please don’t tell me otherwise:)