These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:03 pm Advanced search

Include file facility

Do you think the HTML spec should do something differently? You can discuss spec feedback here, but you should send it to the WHATWG mailing list or file a bug in the W3C bugzilla for it to be considered.

Include file facility

Postby kkobashi » Sun Jun 05, 2011 2:42 pm

Why doesn't HTML5 have an include file facility?
There can be so much to gain by having this - namely reusability.

Code: Select all
<!doctype html>
<html lang="en">
<meta charset="utf-8"/>
<meta http-equiv="content-type" content="text/html"/>
<link rel="stylesheet" media="screen" href="screen.css"/>
<base href=""/>
  <include src="header.html"/>
  <include src="nav.html"/>
  <include src="sidebar.html"/>
  <include src="/cms/articleEngine.php" param="viewType=2"/>
  <include src="footer.html"/>

<img src="/images/logo.png" alt="Logo"/>

<li><a href="home.html">Home</a></li>
<li><a href="contact.html">Contact</a></li>
<li><a href="about.html">About</a></li>

<div id="register">
<include src="registerForm.html"/>
<div id="ad">
<include src="googleAd.html"/>

<p>Copyright &copy; 2011. All rights reserved</p>

ArticleEngine($_GET['param'], $numArticles=4);

By default, files are relative from the base.
Posts: 1
Joined: Sun Jun 05, 2011 1:57 pm
Location: Silicon Valley, California

Re: Include file facility

Postby JAB Creations » Mon Jun 06, 2011 7:50 am

I use the base element myself and if I'm not mistaken HTML5 does include the base element...

(Warning, large page.) ... se-element
User avatar
JAB Creations
Posts: 566
Joined: Tue Mar 13, 2007 4:48 am
Location: Sarasota Florida, USA

Re: Include file facility

Postby Xdega » Thu Jun 16, 2011 3:28 pm

php also accomplishes the same thing very easily.
Posts: 124
Joined: Tue Mar 01, 2011 6:30 pm
Location: USA

Re: Include file facility

Postby Pacoup » Thu Jun 23, 2011 7:33 pm

Xdega wrote:php also accomplishes the same thing very easily.

I agree. I don't think raw HTML pages should be able to make server-side file calling like this, and maybe it's never been done for technical reasons considering the server-side aspect required, but here's something that might make you want to reconsider:

Client-facing users can't see your PHP code, but they would be able to see your stray HTML pages, leading to search engines indexing your Header page, your Nav page, etc. individually. Conversely, using PHP allows exactly the same thing, except that for a client-side facing navigator, such as a search engine's indexing spider, every content page is a unique page, which is essentially what you want to achieve to get the right SEO.
User avatar
Posts: 12
Joined: Mon Aug 18, 2008 2:20 pm
Location: Canada, Ontario, Ottawa

Return to Feedback on the Specs

Who is online

Users browsing this forum: No registered users and 1 guest