|
-
Sep 23rd, 2004, 04:29 AM
#1
Thread Starter
Fanatic Member
[solved] xhtml - include
can i do something like this on xhtml?
Code:
<?php include "some.php" ?>
if so, how? thank you.
Last edited by brown monkey; Sep 24th, 2004 at 04:41 AM.
-
Sep 23rd, 2004, 05:28 AM
#2
Frenzied Member
yes you can. the PHP can still insert XHTML. here's an example:
PHP Code:
<?
include "header.php";
?>
<p>
More code can go here.
</p>
<hr />
<p>
This causes noproblem at all. the PHP simply pulls more code from the included files. Just make sure that the code from them is valid. Of course the page will still show if it's not.
</p>
Have I helped you? Please Rate my posts. 
-
Sep 23rd, 2004, 06:32 AM
#3
PHP just generates text. It's up to you to ensure that this text is well-formed XHTML.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Sep 23rd, 2004, 09:05 PM
#4
Thread Starter
Fanatic Member
sorry for the misleading fellas. sorry about my english. what i want to know is actually the include feature of php, if there's any in xhtml. something like modularizing.
Code:
<?php include "some.php" ?>
can i have something like that in xhtml? say, i save a TOC.XHTML and i want to put it in a certain div
Code:
<div>
<!-- include TOC.XHTML -->
</div>
hope i clear myself up. thank you.
-
Sep 24th, 2004, 04:32 AM
#5
Frenzied Member
not in XHTML itself, but you can just use PHP again.
PHP Code:
<div>
<? include "div_contents.php"; ?>
</div>
Have I helped you? Please Rate my posts. 
-
Sep 24th, 2004, 04:40 AM
#6
Thread Starter
Fanatic Member
ah ok. thank you very much. so, there's none in xhtml about including stuff. thank you thank you.
-
Sep 24th, 2004, 04:50 AM
#7
There are various methods, but none is really XHTML.
1) PHP or other script includes.
2) Server-Side Includes (SSI). You just have to reconfigure your server a bit to make it work.
These two actually work. The following are theory.
3) Since XHTML is XML, this should work:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "..." "..." [
<!ENTITY header SYSTEM "http://mydomain/includes/header.ent">
]>
<html xmlns="...">
<head>
</head>
<body>
&header;
</body>
</html>
The problem is that no browser I know of actually applies external parsed entities.
4) The XLink specification has a way of directly putting stuff into a document.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="..." xmlns:xlink="...">
<head></head>
<body>
<div id="menu" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" xlink:href="includes/header.xhtml"/>
</body>
</html>
Again, there's zero browser support for this. Mozilla will go farthest in that it might make a normal clickable link to header.xhtml out of this.
5) XIncludes. This is another way of getting data into a document, and it's just as poorly supported as the other methods.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="..." xmlns:xinc="...">
<head></head>
<body>
<xinc:include href="includes/header.xhtml" parse="xml"><xinc:fallback>
<h1>Header</h1>
</xinc:fallback></xinc:include>
<body>
</html>
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|