PDA

View Full Version : Includes



Meti
09-04-2009, 08:58 AM
Hello there.
I know you can use PHP includes.
But I've also seen HTML includes.
Can anyone tell/show me how to use HTML includes?

I really like includes :P

+REP in advance.

hamheyelliot
09-04-2009, 12:27 PM
From About.com:

An include is a section of HTML that isn't a full HTML document by itself. Instead, it is a portion of another page that can be included in complete Web pages using programming. Unfortunately, this is not something that is supported by HTML, so you need to have some type of program or script to add your include files into your Web pages.
Most include files are items that are repeated on multiple pages of a Web site without changing, like:


navigation
copyright information
contact notices


The Server Side Include code for HTML includes;

<!--#include virtual="path to file/include-file.html" -->

PHP for HTML includes;

<?php
require($DOCUMENT_ROOT . "path to file/include-file.html");
?>

ASP for HTML includes;

<!--#include file="path to file/include-file.html"-->

Meti
09-04-2009, 01:32 PM
But I've seen HTML includes on other sites.
Ex: www.blocket.se - The blue links on the left side.
It's Swedish, but I hope you'll see.

Also;

#include
Du kan även inkludera en HTML-fil, dvs fil med tillägget .html. Men var noga med att inte ha i denna fil element som bara får förekomma en gång per dokument, såsom elementet HTML, hela huvuddelen och elementet BODY. Finns det (t ex) två BODY i ett dokument kommer dokumentet att vara ogiltigt.

virtual
Anger en virtuell sökväg till ett dokument som finns på servern

<!--#include virtual="/~server/virtual_dokument.txt"-->

file
Anger en sökväg till det aktuella biblioteket

<!--#include file="dokument.txt"-->

It's swedish, but they say it works?

Want to hide these adverts? Register an account for free!