Jump to content

What is the correct way to use includes


ragrim

Recommended Posts

Hi,

 

Im pretty much self taught when it comes to php, never read any books just picked things up as i go, and im looking for some advice on how i build my pages as i believe im not approaching it correctly.

 

Basically i build an index.php, this contains my header, footer, and any menus i may have, then for my content pages, in this case products, contact, about us i use use an include so these content pages just have content.

 

Now by doing this my address bar looks like this index.php?location=contact.php

 

for the sake of google and search results and so on, am i limiting my ability to be found by not using a differant file for each page? should i include a header, footer, menu etc within my content pages rather than the other way around?

 

Thanks in advance for any advice.

Link to comment
https://forums.phpfreaks.com/topic/257435-what-is-the-correct-way-to-use-includes/
Share on other sites

If you do it the way you are doing it, via the address bar, I would use custom names instead the file name.

If you don't someone could call a filename and load one.

 

You are not losing Google juice from doing that

 

I personally include the header and footer but you can do it either way, it won't make a difference to the user.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.