Jump to content

Php - $title


Norman

Recommended Posts

Hello, I have an index.php and an header.php. I want to show a different title per page, then I have thought to include my header.php and there put this:

<title><?php $title ?></title>

.. and in my index.php put this:

<?phpinclude 'header.php';$title = 'My Index Title'; ?>

.. and so on for the other pages. But I get a 'undefinied variable' message. Why?

Link to comment
Share on other sites

Define your variables before you include a file that uses them. In your case:

<?php$title = 'My Index Title';include 'header.php'; ?>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...