Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Dal123

macrumors 6502a
Original poster
Oct 23, 2008
903
0
England
I'm having problems echoing out my <title> tag.

On the same page I have my html 5 as:
Code:
<title><?php echo $pagetitle;?></title>
In the header section.

A little below in the same document I then have:
PHP:
<?php $pagetitle='My cool title';?>

However it is not working. I thought this was a global scope and when the directories were of a different structure in my old website this used to work.

Does anyone know why this won't work and how I can get it to work?
 
I'm having problems echoing out my <title> tag.

On the same page I have my html 5 as:
Code:
<title><?php echo $pagetitle;?></title>
In the header section.

A little below in the same document I then have:
PHP:
<?php $pagetitle='My cool title';?>

However it is not working. I thought this was a global scope and when the directories were of a different structure in my old website this used to work.

Does anyone know why this won't work and how I can get it to work?

you need to set your $pagetitle before the echo occurs. You seems to be setting the value after.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.