What feature do I find in HTML, as an option to PHP Include?

Asked

Viewed 107 times

2

What features do I find inside an HTML page, to make segments independent of a page (Head, Body, footer, etc.) just like it happens using include? So that only one page would suffice, facing 30 pages that would use the same information.

Thank you all.

1 answer

1

According to the W3C documentation there are two ways for you to do this.

Sometimes, rather than linking to a Document, an Author may want to embed it directly into a Primary HTML Document. Authors may use either the IFRAME element or the OBJECT element for this purpose

Documentation on the <object>: https://www.w3.org/TR/html4/struct/objects.html

Way to use:

<OBJECT data="embed_me.html">
Warning: embed_me.html could not be embedded.
</OBJECT>

Documentation on the <iframe>: https://www.w3.org/TR/html4/present/frames.html#edef-IFRAME

Way to use:

<IFRAME src="foo.html" width="400" height="500" scrolling="auto" frameborder="1">
  [Your user agent does not support frames or is currently configured
  not to display frames. However, you may visit
  <A href="foo.html">the related document.</A>]
</IFRAME>

OBS1: For the above two methods there are a number of particularities! Be sure to read the documentation...

OBS2: Regardless of that I state to use the include same and as a last resort, required_once also with PHP

  • Thank you Hugo. I’m taking a look at the documentation.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.