Please help with PHP and META tags.

liunx

Guest
I am new to PHP, and only know the basics. How are meta tags used with php?

I have a header.php

a index.php

and a footer.php

The index.php calls the header and footer. I have my meta tags in the header.php file. Is this ok? Will search engines still see this, or do they just search the text located in the index file, and not the files it calls on. Thus not seeing my meta tags.

Sorry for the newbish questions and wording.I'm sure that its fine as long as meta tags are not embedded into the php code itself

i.e

<?
//php
?>

<!-- meta tags -->

<?
//php
?>well here is a basic version of the index page.


<?php

require_once( 'config.php' );

function Main()
{
/* Including the Header section */
include( 'header.php' );

Index page code here

/* Including the Footer section */
include( 'footer.php' );
}

Main();

?>


And my header file starts like this.


<html>
<head>
<meta name="Keywords" content="America's Army, AA, AA:O, FPS, First Person Shooter, Squad, Team, Clan, Voice, Chat, Fun, Firends, TWL, Team warfare, ladder, lader, Quake, RTCW, Wolfenstein, Rainbow six, ghost recon, Raven Shield">
<meta name="Description" content="A gorup of gamers that like to play America's army and other FPS or team based games. We use voice chat for all games we play and are friendly to all new comers.">
<meta name="Title" content="Up All Nighers">
<meta name="Author" content="[email protected]">
<meta name="Subject" content="First Person Shooter Games">
<meta name="Language" content="English">
<meta name="Robots" content="All">well tha ti sok, but your process is not good. don't put the whole page in a function, just put it seperate like this:

<?php

require_once( 'config.php' );

/* Including the Header section */
include( 'header.php' );

Index page code here

/* Including the Footer section */
include( 'footer.php' );


?>yep :) nice work scoutt.. use includes as they work just like ssi includesOriginally posted by scoutt
well tha ti sok, but your process is not good. don't put the whole page in a function, just put it seperate like this:

<?php

require_once( 'config.php' );

/* Including the Header section */
include( 'header.php' );

Index page code here

/* Including the Footer section */
include( 'footer.php' );


?>


Thanks, I got it from a turorial. I don't think I need to require the config either. But it's working so I myaswell leave it.

BTW what is wrong with haveing it as a function. I trust you, I was just wondering why?

***Edit
Testing sig.well, it is not wrong, but bad design. you want your code free flowing and not all stuck in a function. sure it is a good idea to have functions but not the the whole page in one. it makes you limited to what you can do.Ok, so the site has been up for about a year now, everything is working great and I have been using scoutt's include method. Though I am not requiring a config... I do not use one, should I?

Anyway, my question comes back to meta tags. I would like to give each page it's own title and description but don't see a way to do that by using one header for all pages. I guess it would be possible to make a meta tag include for each page but that seems wasteful and sloppy.

I have also read that meta keywords are used only by one search engine now and they do not really help you at all. If this is true do I not have to worry about them in any new sites I create? Any thoughts on this?the only basic way is to right a description for each and every page. yes you have to insert a meta tag for all pages. although the search engines are getting awy from the meta description and ketowrds, some still use them, not just one. so yes it is still a good idea to include them.

keep the "keywords", "description" and "robots" tags and throw the others away. they don't do anything relevant anymore. you will need to add a content-type tag

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

and use teh correct charset for your site.

make sure you have a doctype at teh very top and then validate it through <!-- w --><a class="postlink" href="http://www.w3.org">www.w3.org</a><!-- w -->

so see you have a ways to go to get that site working in tip top shape. :)
 
Back
Top