Forum Moderators: coopster

Message Too Old, No Replies

Creating meta tags in Php

         

skewe

2:34 pm on Mar 18, 2006 (gmt 0)

10+ Year Member



I am trying to create automatic meta tags for each page, how do i do it via Php.
Running the site on Php

[edited by: jatar_k at 3:20 pm (utc) on Mar. 18, 2006]
[edit reason] no urls thanks [/edit]

coopster

8:13 pm on Mar 18, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, skewe.

You can write whatever meta elements you like with PHP, just like you would write out any other HTML element(s).

skewe

1:42 am on Mar 19, 2006 (gmt 0)

10+ Year Member



thanks

Steerpike

2:56 am on Mar 20, 2006 (gmt 0)

10+ Year Member



This looks like the right place to ask a question I've been wondering about.

I've developed (at my bosses insistance) a cms that allows the users to change content and also to change meta tags. I store the meta tags in the database and grab them when the page loads.

My question is: Will this even work for spiders? Ie, do spiders just read the file itself (in which case they'll just see the php tags) or do they actually process the page first like a browser and then look at it?

Sorry for the novice question (and for hijacking a thread).

Steerpike

grandpa

4:38 am on Mar 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Steerpike, a spider is little more than a browser, without the screen display (I bet I catch some flak on that one :) )

So yes, it will work fine for spiders if you are seeing the results on your screen. If your db connections and/or queries fail, then the spiders will see nothing for your metatags. Probably not much much to worry about there. Just the same, on some of my pages I do check to see if the database values are present, and if they aren't then I have a hardcoded option to display instead.

if (isset($database_variable)) echo 'this';
else echo 'that';