Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

eclipse

macrumors 6502a
Original poster
Nov 18, 2005
989
14
Sydney
Hi all,
I'm using Kompozer at the moment and to replace the "Components" function of GoLive (which I found destroyed the code worse than Kompozer) I am using php scripts. This is so that I can design a php include page for my menus, and if I have to just edit the MENU navigation bar page rather than ALL the pages on my website. Something to experiment with anyway.

So.... are there side effects having all web-pages end in .php instead of html? Are there browsers that have more trouble with this? Thanks.
 
All of my pages have a .php extension. Most include php script, but some don't. I've never had a problem.
 
Parse the .html pages

Hi eclipse,

I use php ssi's on my website for the Nav pane as well as header and footer sections but I kept the .html page endings instead of changing them all to .php.

I added the following Apache Handler that made the server parse the .html pages. Easier than renaming files.

AddHandler server-parsed .shtml

I don't know if this will work in your case but hopefully someone with more experience will post more.

I can't think of any side effects.

Cheers
 
Name your page something.php

<?php

include(header.php);
include(nav.php);
include(footer.php);

?>

and so on.... Whatever constants you want displayed on every page.
 
OK Notnek, but does doing that place them all together? ? What code do I need on the include pages to tell the headers and footers where to go, if you see what I mean? I thought the PHP script had to be put on the page where you actually wanted them to show up, not bunched up together?
 
Turns out, I was wrong. I got out a trusting book and found the right answer. I'll just explain how to do it for your menu.

Create a file named navigation.inc

In this file, treat it as any html page. Layout your divs, content, css, whatever. But just your menu code.

In your regular pages (something.php), where you're menu would go:

<?php require('navigation.inc'); ?>

That will output the menu that you created in navigation.inc



If you want to have every section of your page like this, just create more pages like header.inc and footer.inc. Then the format of your site will be consistent and when you want to change something, you just have to edit one file rather than all of them.


I hope this helps. Sorry for being wrong and confusing earlier!
 
Oh? I thought the code was...

<?php include("myinclude.php") ?>

It works for me... you can see at this page the only thing I actually had really on this page was the title in bold, everything else comes from my test menu php page.

(Just very basic for testing purposes).

The php code has gone invisible though... it used to be pink!

http://lanksheardesign.com/folio-books.php
 
That works. PHP will be invisible in the source and on the page. That's one thing that makes it great. As long as you're getting the content from the include file, then it's correct. Good luck with the rest of your project. If you need any help with more stuff, just PM me.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.