PDA

View Full Version : Link to FW html menu


timinator
12-12-2008, 08:24 PM
Hi, I created an navigational menu in Fireworks and exported the html to be inserted into my Dreamweaver pages. Is there a way for each page to link to one menu rather than making numerous copies? Can this be done without creating a template? This would save a lot of time when a change is needed to be made in the menu.

Thanks

coloeagle
12-12-2008, 09:42 PM
Depends on what extension your pages use on which way this can be achieved. If your host supports php you could use php server side includes or with asp you could use virtual includes.

timinator
12-15-2008, 01:00 PM
The pages use .html extensions. The server does support php scripting.

coloeagle
12-15-2008, 06:23 PM
OK good.

Assuming (I hate using that word) you have a .htaccess file if not create one.

In this file add the following line
AddType application/x-httpd-php .php .html .htm

This will now allow your html pages to parse php scripts.

You will need to have your menu only on a page all by itself.

In the site pages where you want the menu to appear add the following.
<?php include('path-to-file/menu.html');?>be sure to change the path-to-file to the proper named path you have.

Now you have one page that controls the menu throughout the entire site. A single page change to update the entire site.

domedia
12-15-2008, 07:16 PM
Just a word of caution 8)
This means that any html page, doesn't matter if it has PHP or not, is going to be treated as PHP. This is going to require extra resources from your server and might lead to a slower website. It sounds better to use the .php extension for .php files and the .html extension for .html files and not parse the .html files as PHP. But that's just me ;)

coloeagle
12-15-2008, 08:34 PM
Just a word of caution 8)
This means that any html page, doesn't matter if it has PHP or not, is going to be treated as PHP. This is going to require extra resources from your server and might lead to a slower website. It sounds better to use the .php extension for .php files and the .html extension for .html files and not parse the .html files as PHP. But that's just me ;)Not really DOM, the basic html pages will still be parsed as html. Now since we would be adding the ability to have it read php scripting then yes, there would be some risk of added load time. This would depend on how big the php script is and what all you are wanting it to do. This falls true whether or not the pages are .php .htm or .html With simple includes this load and display time is so minuscule not sure you would even be able to measure it.

domedia
12-15-2008, 10:27 PM
Not really DOM, the basic html pages will still be parsed as html. Sorry, poor choice of words. :) I meant they're handled by the PHP parser even though there might not be PHP in there.
But isn't it a rather strange approach, why would you do it this way?

coloeagle
12-15-2008, 11:38 PM
Sorry, poor choice of words. :) I meant they're handled by the PHP parser even though there might not be PHP in there.
But isn't it a rather strange approach, why would you do it this way?That's ok Dom, no need to apologize.

There are several reasons one would need/want to do it this way I'll explain the two most popular.

Let's start with the normal/typical situation.
Note: Text editors by default will save a page as .html or .htm this is fine and can be controlled by the more experienced user. But what if your new and inexperienced to the different scripting languages, their advantages and disadvantages.

You start out with a small site of just a few .html pages.
The site then grows to a few dozen pages. It becomes work and takes a lot of time just to go in and update the menu or a particular section of the pages.

You look into different ways to control this and still maintain consistency. JS is usually the first thing you find that would accomplish this. Now this brings up two issues.
1. Some users(though a small percentage) either have JS turned off or don't use JS.
2. JS can't be read by the SE's

Along comes PHP. Not affected by JS settings and writes the actual content into the page making it se friendly

The problem,

You have IBL's to the .html pages and these pages are already indexed in the SE's.
If you change all your extensions to .php you lose the ibl's and the existing se indexing.

The answer,

By using the .htaccess rule you gain the power of php without the need to go in and change all existing page extensions. You don't lose your ibl's or the se indexing.

Another popular scenario.

You have some dynamic content that you want displayed on the page. This content will change each time the page is displayed/refreshed.
Again this can be done with js but just as mentioned above this has two problems.
With a php script you can do this and everybody is happy.

domedia
12-16-2008, 01:46 AM
That was a pretty comprehensive explanation colo, thanks!

Thought: rename all the html extensions to php and using a rewrite rule in the htaccess file?

coloeagle
12-16-2008, 02:25 PM
You could do that, and I may be wrong but I believe that would still cause the new php page indexing issue for the se's.