Has the coding for html links/pathway changed?

A

Anonymous

Guest
Hello.

Can I please just ask if the coding to include one html or php file in another html file?

In my project, I've built basic page, but I would like to include a header and a side menu, however, all I'm getting is a blank rectangle when try to load it online, but it works ok, offline. I am using the / and not \. At present, I'm attempting to load the header first.

My code reads:-
<html>
<head>
<title>MySite</title>
<link rel="stylesheet" type="text/css" href="memberhome.css">
</head>

<body>
<IFRAME name="iframe" src="../header/headerm.php" width=1200px height=100 frameborder=0 scrolling=auto></IFRAME>

<div id="menuside">
<h3>
The Side Menu
</h3>
<p>12345678901234567890<br></p>
<IFRAME name="iframe" src="../navigation/mainmenu.php" width=150 height=50 frameborder=0 scrolling=auto></IFRAME>
</div>
</body>
</html>

The directory structure is:-
Root > which includes index.php
|
- Core
|
|- header > Which includes the filename header.
|- user > this includes user.html, which has the above code in it.

Out of interest, is there an equivant to php's require/include available in html
I can't move forward if I can't load the header and menu, and not sure how to get around this.

Any guidance would be welcomed.
Thank You very much. :)
 
IFrames are kinda old and ugly, why not rename your .html file as .php then you include your php files normally?
 
Hello element121,

Thank you for your reply.

I did originally try and create it in php.
However I was unable to create the layout I wanted, and I was unable to use div or load the style sheet.

Kind Regards
 
Using a div or a loading a stylesheet is the same in a PHP file.

Just split the html and php with the PHP tags:

Code:
<?php
// PHP HERE
?>
HTML HERE
<?php
// PHP HERE
?>
HTML HERE
<?php
// PHP HERE
?>
 
Hello element121,

Thank you for your reply.
From your sample, I think I've spotted where I went wrong, I used <body> / </body> inside the <?php / ?> in my last attempt.

I'll try again.

Kind Regards.
 
Back
Top