Forum Moderators: phranque
FrontPage Includes
FP Includes function very similar to SSI (Server Side Includes). There is one major difference and that is the way the pages are developed. With FP, its a complete web page. With SSI, it is the content which is to be included into the destination page. It might contain a navigation div with list items, etc. Here's a previous topic on how FP Includes function...
Example of FrontPage Include Syntax...
<!--webbot bot="include" u-include="file.asp" tag="body" --> ASP Includes
Since I develop primarily in asp, my file extensions are in the .asp format. With .asp, I have two methods of including content.
Example of ASP Include Syntax
<!-- #include virtual="/file.asp" -->
<!-- #include file="file.asp" --> I use the Virtual method exclusively due to the way I structure and organize included content.
The problem with asp includes is that they contain only the html code to be included in the destination page. I cannot view those pages at the browser level with all their proper formatting. They don't function like FP includes.
Server Side Includes
Then you have SSI (Server Side Includes) which I've seen many confusing topics on concerning the .shtml extension. Basically it comes down to this, if you are using SSI, you need to configure IIS to parse your .htm files as .shtml. Its a simple process as far as I can tell. SSI's function just like ASP includes.
Example of SSI Syntax
<!--#include file="/file.asp" --> I've not investigated all of the methods available and was hoping that someone with more technical knowledge of this can correct me if I'm wrong in my above synopsis.
Is there an include method that functions just like FP's way? I mean, I'd like to browse to that include page and see it formatted just the way it should be once included into its destination page. Am I missing something here?
What other methods are available for including content? Please do provide code examples so that all reading can understand how to do this, including me! ;)
However, I did want to warn you about one thing you need to be aware of if you decide to use SSI by telling IIS to process .html pages as .shtml... to do so will circumvent any .asp processing. IOW, IIS won't know to process the page first as .shtml, then to do it again as .asp. You basically get one pass through a script engine.
If that's not a concern, then never mind :) Also, since I've never actually tried the above, I'm only 99%+ positive about it ;)
Since you work in .asp, have you considered using asp.net? The 2.0 version uses a better (IMO) include method called "Master Pages".
apologies, I will just link to a thread from the PHP library that talks about it
A dynamic site in 2 minutes [webmasterworld.com]
it essentially deals with templating but this holds the essence of using includes with PHP
reference:
include [php.net]
include_once [php.net]
require [php.net]
require_once [php.net]
<edit>I guess I should add
if you use dreamweaver it will process these includes properly (I believe) and display the finished product in your fancy little WYSIWYG editor.
You don't necessarily have to have .php files to use php functionality, you can do the same thing you mentioned for .shtml and setup php parsing on any file extension you like. Though, as Bluesplinter mentioned, you can only parse any given extension for 1 scripting language. There are ways around this by using exec and the like in php, or even SSI for that matter, but these are not always an option for everyone. They have some unpredictable results.
[edited by: jatar_k at 10:47 pm (utc) on Dec. 28, 2005]
However, I did want to warn you about one thing you need to be aware of if you decide to use SSI by telling IIS to process .html pages as .shtml... to do so will circumvent any .asp processing.
I wondered about that, thanks for bringing it up. I've since decided that the ASP Virtual Include method is probably going to be my best alternative. I need to make some changes to my local system so it acts like a server and executes those includes while I'm in development mode.
I'd still like to see all of the other available methods for including content.
ASP.NET?
Wouldn't touch it with a 10 foot WYSIWYG stick. It is IE centric, it produces invalid code (uses quite a bit of proprietary tagging) and you can't work on it with a WYSIWYG editor, you need to use Visual Studio which I'm not familiar with. It is a programmer's dream and an html coders nightmare!
Wouldn't touch it with a 10 foot WYSIWYG stick. It is IE centric, it produces invalid code
But, I'm not a .net evangelist, so if you're happy with .asp includes, that's cool with me :) After all, I still use old Coldfusion code on some of my sites... if it ain't broke, etc.
I have thought about doing this but since I also use virtual links in my image paths I have gotten used to not seeing too much :)
-Corey