Include html text in a webpage

G

Gregor Traven

Hi,

I want to include a certain html page or just a piece of html text that is
written in any other file in my html page. How can i do it?

All my html pages have a common header or menu so I want to know how to
include a html text that defines this header or menu in all my html
documents. When I want to update header or menu, i just need to update one
file only.

Thanks for answering

Gregor
 
J

Jeffrey Silverman

Hi,

I want to include a certain html page or just a piece of html text that is
written in any other file in my html page. How can i do it?

All my html pages have a common header or menu so I want to know how to
include a html text that defines this header or menu in all my html
documents. When I want to update header or menu, i just need to update one
file only.

Thanks for answering

Gregor

SSI:
<!--#include filename.html -->

PHP:
<?include("filename.html");?>

ASP:
Uses SSI Syntax

JSP:
Not sure of syntax. It is probably possible, though.

ColdFusion:
Not sure. Can probably use SSI syntax, though.

etc....
 
M

Michael Fesser

.oO(Jeffrey Silverman)
PHP:
<?include("filename.html");?>

Short open tags are unreliable, so it should be

<?php ... ?>

And JFTR: 'include' doesn't require parentheses, it's no function.

Micha
 
B

brucie

In alt.html David Dorward said:
More precisely, short tags are turned off on some installs of PHP, not least
because they need working around when an XML prolog is used.

i thought he was referring to some prase error bug thingy.
Its a configuration option.

which doesn't make them unreliable.
 
D

David Dorward

which doesn't make them unreliable.

It does in the sense that if you distribute the script you can't know if it
will work in the target environment. :)
 
M

Michael Fesser

.oO(brucie)
In alt.html Michael Fesser said:


URL?

<http://www.php.net/manual/en/language.basic-syntax.php#language.basic-syntax.phpmode>

"The first way, <?php. . .?>, is the preferred method, as it allows the
use of PHP in XML-conformant code such as XHTML.

The second way is not available always. Short tags are available only
when they have been enabled. This can be done via the short_tags()
function (PHP 3 only), by enabling the short_open_tag configuration
setting in the PHP config file, or by compiling PHP with the
--enable-short-tags option to configure. Even if it is enabled by
default in php.ini-dist, use of short tags are discouraged."

Micha
 
J

Jeffrey Silverman

It does in the sense that if you distribute the script you can't know if it
will work in the target environment. :)

How about "less portable," then, instead of "unreliable"?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top