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

Similar Threads
thread Thread Starter Forum Replies Last Post
[php] - php problems os x mountain lion 10.8.2 cakas6933 OS X 10.8 Mountain Lion 4 Jun 10, 2014 08:08 AM
How do you create a title page san001 Digital Video 4 Apr 9, 2014 03:23 AM
iPad: How to get title of TV show to display on the grid page of iPad Videos app? patent10021 iPad 3 Dec 15, 2013 01:01 AM

Forum Jump

All times are GMT -5. The time now is 06:20 AM.

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

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