Current location: Hot Scripts Forums » Programming Languages » PHP » <head>titles as php?


<head>titles as php?

Reply
  #1 (permalink)  
Old 08-18-04, 03:49 PM
steveo steveo is offline
Wannabe Coder
 
Join Date: Jun 2004
Posts: 130
Thanks: 0
Thanked 0 Times in 0 Posts
<head>titles as php?

Hey, I have a website, and it has alot of pages. I would like each page to have it's own title, however my website uses php includes for the header and footer.


I want to be able to make my photos page, say photos in the title for example "Mysite.com - Gallery!"

I have tried to name them like vraiables (spelling?)

like:
The header page
PHP Code:

<html>

<head>
<title>Mysite.com <?php echo ("$titletop"?></title>
</head>
and on the .php page
PHP Code:

<?php include ("header.html"?>

<?php $titletop
="Gallery!" ?>
I don't see what's wrong. If anyone could give me an easier way, or maybe i'm just doing this wrong? >_>
Reply With Quote
  #2 (permalink)  
Old 08-18-04, 03:55 PM
Bonzo's Avatar
Bonzo Bonzo is offline
Coding Addict
 
Join Date: Jan 2004
Posts: 340
Thanks: 0
Thanked 0 Times in 0 Posts
I tried that as well but I think the problem is the header is first, the php is included and then you are declaing the variable for the title.

I did a bodge - there must be a better way with arrays - At the top of the page I have :
PHP Code:

if ( $page == '1' ) { $title 'Page 1"; }

elseif ( $page == '
2' ) { $title = 'page 2'; }
// etc. 
Anthony
Reply With Quote
  #3 (permalink)  
Old 08-18-04, 03:57 PM
Eclipse's Avatar
Eclipse Eclipse is offline
Coding Addict
 
Join Date: May 2004
Location: Long Island, New York
Posts: 356
Thanks: 0
Thanked 0 Times in 0 Posts
you can only call variables when you define it first like you can't define on line #5 and call it on #3 you'd need to define the variable before the title and you didn't end the lines ie. :
PHP Code:

<?

include ("header.html");
$titletop="Gallery!";
?>
<html>
<head>
<title>Mysite.com <?php echo ("$titletop"); ?></title>
</head>
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP and MySQL ? rob2132 Hot Scripts Forum Questions, Suggestions and Feedback 4 08-29-08 02:22 AM
php with Apache in windows eDevil PHP 3 08-08-04 12:03 AM
PHP integrated with ASP Mikeirv PHP 7 05-25-04 05:00 AM
100 Web Templates & 10 PHP Scripts for sale! HostersUK.co.uk General Advertisements 0 01-10-04 12:31 AM
Realtime PHP Code Obfuscation barrywien General Advertisements 1 11-16-03 06:50 PM


All times are GMT -5. The time now is 04:20 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.