Reply
PHP and <gasp> meta tags
Old 02-22-2005, 07:19 PM PHP and <gasp> meta tags
Harvey's Avatar
Super Spam Talker

Posts: 901
Name: Harvey C
Location: Brighton, UK
Hi,

I've used a simple bit of PHP on my index.php. Here it is:

PHP Code:
<?php
header
("Location: exchange/index.php"); 
?>
As you'll know, that just includes the index in /exchange. Since this is my index page, I'd like to have meta tags on it but can't do this without getting some sort of error!

Could somebody please tell me the correct way to add meta tags to the index.php file?
Harvey is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 02-23-2005, 01:14 AM
Average Talker

Posts: 17
That code redirects the user to "exchange/index.php", it doesn't include it. Also, if you try to send any text prior to using header(), you will get an error saying something like "Header already sent".
bizpile is offline
Reply With Quote
View Public Profile Visit bizpile's homepage!
 
Old 02-23-2005, 01:52 AM
Skilled Talker

Posts: 62
Being that you want to display meta tags, I don't think your goal is to redirect the user to another page.
It sounds like you are trying to include exchange/index.php on index.php.
If you want to do that...
PHP Code:
<?php
include('exchange/index.php');
?>
Good luck!
-Jason
The Jasong is offline
Reply With Quote
View Public Profile
 
Old 02-23-2005, 04:26 AM
Harvey's Avatar
Super Spam Talker

Posts: 901
Name: Harvey C
Location: Brighton, UK
If I try:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Description" content="The most popular free banner exchange: drive targeted traffic to your site with our excellent ratio of 4:3!">
<meta name="Keywords" content="banner exchange,free traffic,traffic,banners,advertising,free advertising,reciprocal linking,free banner exchange,more visitors">
</head>
</html>
<?php
include('exchange/index.php');
?>

I get this error at the top of the page:

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/bannerad/public_html/index.php:7) in /home/bannerad/public_html/exchange/index.php on line 2

How can I add the make the index of /exchange the index of the site and have meta tags?!

Thanks so much

Last edited by harveycarpenter : 02-23-2005 at 06:53 AM.
Harvey is offline
Reply With Quote
View Public Profile
 
Old 02-23-2005, 10:37 AM
Average Talker

Posts: 17
Quote:
Originally Posted by harveycarpenter
If I try:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Description" content="The most popular free banner exchange: drive targeted traffic to your site with our excellent ratio of 4:3!">
<meta name="Keywords" content="banner exchange,free traffic,traffic,banners,advertising,free advertising,reciprocal linking,free banner exchange,more visitors">
</head>
</html>
<?php
include('exchange/index.php');
?>

I get this error at the top of the page:

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/bannerad/public_html/index.php:7) in /home/bannerad/public_html/exchange/index.php on line 2

How can I add the make the index of /exchange the index of the site and have meta tags?!

Thanks so much
That is because you are starting a session in "exchange/index.php". Sessions are like header(), you can not try to start on after you send any text. You are going to need to put the META tags in "exchange/index.php" or do without them. You would probably be better off either redirecting the user to "exchange/index.php" or copying the file into your other directory and modifying it there to include your META tags.
bizpile is offline
Reply With Quote
View Public Profile Visit bizpile's homepage!
 
Old 02-23-2005, 11:23 AM
Gaffer Sports's Avatar
Ultra Talker

Posts: 397
Name: Steve
Location: Scotland
I think I see what you are trying to do and it can be achieved fairly easily.

If you need help, drop me a PM

Steve.
__________________
Media Help & Discussion

Last edited by Gaffer Sports : 02-23-2005 at 11:29 AM.
Gaffer Sports is offline
Reply With Quote
View Public Profile Visit Gaffer Sports's homepage!
 
Old 02-23-2005, 12:10 PM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
You need to call session_start() before you write any html or include() anything. Just put the session stuff at the top of the script - once this finishes you can echo meta tags and include stuff to your heart's content.
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';
Scribble Pad MOD for phpBB (aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Reply     « Reply to PHP and <gasp> meta tags
 

Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.15202 seconds with 12 queries