Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 3, 2014, 01:45 PM   #1
Dal123
macrumors 6502a
 
Dal123's Avatar
 
Join Date: Oct 2008
Location: England
PHP Variable page title.

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 Code:
<?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?
__________________
concretestairslondon.co.uk
Dal123 is offline   0 Reply With Quote
Old Jan 3, 2014, 03:39 PM   #2
Darth.Titan
macrumors 68020
 
Darth.Titan's Avatar
 
Join Date: Oct 2007
You have to define the $pagetitle variable BEFORE you can echo it.
Darth.Titan is offline   2 Reply With Quote
Old Jan 5, 2014, 07:19 AM   #3
slayerizer
macrumors regular
 
Join Date: Nov 2012
Location: Canada
Quote:
Originally Posted by Dal123 View Post
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 Code:
<?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.
__________________
Export your music with MusikAnywhere for OSX --- 24" iMac 2008,6gb,1TB HDD
slayerizer is offline   0 Reply With Quote

Reply
MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 04:00 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC