Jump to content

Question of logic


JoeBlood

Recommended Posts

Hi All, I'm pretty new to web development, and playing with some php.

 

Scenario:

I have a separate 'header.php' file, which displays among other things the page title, aka <td><?php echo $pagetitle; ?></td> whenever it is invoked by each page.

Then each page invokes the header by:

 

<?php

$pagetitle="Whatever";

include('includes/header.php');

?>

 

But when I load the page, either an error message (within the header) yells about the undefined variable 'pagetitle', (although I defined it in the calling page), or if I turn the error off it displays no text at all.

 

How do I pass this page title variable to the header file when it is called?  Or better still, how can 'header.php' determine the calling page title automatically and display it accordingly?

 

Thank you!

 

JB

 

Link to comment
https://forums.phpfreaks.com/topic/234242-question-of-logic/
Share on other sites

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.