Has the coding for html links/pathway changed?

Discussing Html . Code , Software , other

Moderators: egami, macek, gesf

Post Reply
IChaps
New php-forum User
New php-forum User
Posts: 123
Joined: Tue Mar 01, 2016 3:07 pm

Sat Jun 18, 2016 9:21 am

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. :)

element121
php-forum Fan User
php-forum Fan User
Posts: 628
Joined: Sat Jun 06, 2015 11:46 am
Contact:

Sat Jun 18, 2016 11:27 am

IFrames are kinda old and ugly, why not rename your .html file as .php then you include your php files normally?

IChaps
New php-forum User
New php-forum User
Posts: 123
Joined: Tue Mar 01, 2016 3:07 pm

Sat Jun 18, 2016 2:57 pm

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

element121
php-forum Fan User
php-forum Fan User
Posts: 628
Joined: Sat Jun 06, 2015 11:46 am
Contact:

Sun Jun 19, 2016 3:41 am

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: Select all

<?php
// PHP HERE
?>
HTML HERE
<?php
// PHP HERE
?>
HTML HERE
<?php
// PHP HERE
?>

IChaps
New php-forum User
New php-forum User
Posts: 123
Joined: Tue Mar 01, 2016 3:07 pm

Sun Jun 19, 2016 6:07 am

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.

Post Reply