Forum Moderators: coopster

Message Too Old, No Replies

Does PHP Import get spidered?

         

ChrisBolton

7:48 pm on Nov 14, 2007 (gmt 0)

10+ Year Member



I have recently read a few articles on the web that suggest that it is a good idea to use PHP to import content that repeats on multiple pages.

The code is for main navigation could be as follows:

<?php include_once("main_nav.html")?>

My question is, would a search spider be able to follow this? If no links actually displayed on the page, if they were all imported, would the search engine think your site was just one page?

Sorry if this question seems a stupid one, I really just don't know how this works.

Chris.

whoisgregg

8:00 pm on Nov 14, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In a nutshell, yes. All the spiders see is the final HTML that gets sent to the browser. They can't actually tell if that final page was generated from one PHP script or a hundred PHP scripts.

So visit a page on your site, select "view source" and you're seeing the same thing that spiders see. As long as it's there, you're good. :)

ChrisBolton

8:34 pm on Nov 14, 2007 (gmt 0)

10+ Year Member



Great stuff thanks.

One last thing, can I leave the link to the CSS file on the page I import TO, or is it wise to add a link on the imported file too?

I don't suppose it matters but best to be sure.

PHP_Chimp

9:06 pm on Nov 14, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your included/required file is in effect added to the code on the page where it is called.
So if you have a link to a css file on either page then it will be available on the 'real' page, as the spiders dont see an include, they just see the product. For the link to be output to the html you would need to have it printed/echoed so that it shows up in the html, but that is the same for links on either the 'real' page or included page.