Question

Locked

How to use variables in my PHP website header file.

By chad.klunk ·
Hello,

I'm trying to use PHP variables so that I can use my header file to display the menu on all my webpages, however, I wanted to be able to change a line of text on each page by setting a variable for the php header to use for each page so for example:

I have my php header file and in it I have a the line

<title>Company Name - <?php $var ?></title>


and on each individual page I have something like:

<?php include "header.php"

$var = "show this line";
?>


does anyone have any ideas why this may not be working? Or any ideas on a different approach to this?

Thanks in advance

-CK

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

PHP header file....

by chad.klunk In reply to How to use variables in m ...

I'm sorry I guess I need to put quotes or something around my PHP example...

in the php header file that has my menu i have the following line.

"<title>Company - <php? $var></title>"

in the individual webpages i have this line of code:

"<?php include 'header.php
$var = 'show this line in title'; ?>"

Collapse -

Respond

by jerryzhang In reply to How to use variables in m ...

Detail more....

Back to Web Development Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums