PHP Include navigation - Alternatives?

  • Pinky
  • Newbie
  • Newbie
  • Pinky
  • Posts: 11

Post 3+ Months Ago

Hey,

On my site, I'm using a php navigation system by using include $page.php. I name the page by index.php?page=whateverpage

Now the problem, it all works fine, but index.php?page=whateverpage is not a valid URL for search engines. With the site being relying 95% on search engine traffic, it's not helping.

So, my original question, is there any other alternatives, just to update the middle bit (If I have to, I may end up using Iframes *gulp*, Iframes with search engines :S).

The ideas I came up with are to just load up each file and view source, then save the full page, and then upload each page completely. Failing that, as I would have to do a lot of work by hand (e.g. re-write php code on every page), I cuold replace the php include with an Iframe, but that isn't a good idea for search engines.

Anyway...what I'm asking, is does anyone have any ideas? Any help would be much appreciated.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Bobbo171
  • Graduate
  • Graduate
  • Bobbo171
  • Posts: 174

Post 3+ Months Ago

you still stick with the PHP includes and put this in your htaccess file

RewriteEngine on
RewriteRule ^info/(.*) /index.php?id=info/$1 [PT]

so instead of it being http://www.adress.com/index.php?id=info/page.php
it will be http://www.adress.com/info/page.php
but you have to have the pages you are including in a folder or location with no image files in it[/code]
  • Pinky
  • Newbie
  • Newbie
  • Pinky
  • Posts: 11

Post 3+ Months Ago

:(

Help? I kind of understood that, but not fully. I've never used .htaccess before, and so don't really understand that. If I just save that in .htaccess and upload to the root directory will it work?

If i don't, would anyone be able to write a file for me?


______________________________________________________


This is my directory structure:

Root:

index.php
home.php
gallery.php etc.

|
-----> Images Folder



______________________________________________________


The variable used to load up the pages is $page, with the pages to be included in the same folder, e.g.

http://www.site.com/index.php?page=home

Again! Any help? Would be very much appreciated. I'm a newbie to .htaccess ,

Pinky
  • Bobbo171
  • Graduate
  • Graduate
  • Bobbo171
  • Posts: 174

Post 3+ Months Ago

well do you have access to you htaccess file? does it show up in your cpanel or ftp?
  • rtm223
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1855
  • Loc: Uk

Post 3+ Months Ago

how about:

every page is a normal style html page, but with .php extension, and then every page has
PHP Code: [ Select ]
 
<?php
 
include('navigation.html');
 
?>
 
 
  1.  
  2. <?php
  3.  
  4. include('navigation.html');
  5.  
  6. ?>
  7.  
  8.  

On every page, where navigation.html just has the code for the nav.

It's a hell of a lot simpler this way.....
  • Pinky
  • Newbie
  • Newbie
  • Pinky
  • Posts: 11

Post 3+ Months Ago

Bobbo, I have access to .htaccess through FTP,

and rtm223, how would that work for the variable bit (sorry! I'm new to all this). Ok, we could add in the code in navigation.php, but how would you give the variables in navigation.php a value? The only way ic an think of doing it is making every navigation link a form button, with the action being navigation.php.

Aside from that I have no ideas.

Pinky
  • rtm223
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1855
  • Loc: Uk

Post 3+ Months Ago

Ok rather than having a site map that looks like:

index.php
index.php?pageid=aboutstuff
index.php?pageid=somethingelse
index.php?pageid=bitsandbobs

you can have:
index.php
aboutstuff.php
somethingelse.php
bitsandbobs,php


You build like a <b>normal website</b> but rather than writing the navigation code into each and every page, you just include the navigation from an external file.

You do not need any variables, as the site nav only ever points to actual .php files. IMO It's a simpler method and is also also intrisically secure because the user has no input into what page is being include()d

If you go to my site, every page has a .php extension, with the same header/navigation/footer. All of the common code is included from each of the .php pages.
  • Pinky
  • Newbie
  • Newbie
  • Pinky
  • Posts: 11

Post 3+ Months Ago

Oh..now I get it. Thanks rtm :D :D

Post Information

  • Total Posts in this topic: 8 posts
  • Users browsing this forum: No registered users and 68 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.