View Full Version : Including .html files in a .php? +Rep!!!
samuelb07
22-03-2008, 06:16 PM
Hey there guys,
I need a html included in a php. For example:
You click a link on the navigation menu and the html appears on the homepage, like www.HabbVillage.co.uk (http://www.HabbVillage.co.uk).
+Rep up for grabs!
Protege
22-03-2008, 06:23 PM
You can include HTML in php pages outside the <?php ?> tags.
<?php
echo("Hi");
?>
<html>
<head>
<title>ImDumb</title>
</head>
<body>
lalala
</body>
</html>
That site is using an iframe to make content appear.
You can tell cos otherwise there'd be a url like
http://www.sitename.com/something.php?page=666
Try this:
http://www.dynamicdrive.com/dynamicindex17/iframessi2.htm
Decode
22-03-2008, 07:23 PM
Make a folder called files and then, add your html files to it.
Use this php code to display them
Your layout code here
<a href="index.php?page=home">Home</a>
<a href="index.php?page=guides">Guides</a>
<?php
$Page = $_GET["page"];
include("files/$Page.html");
?>
Your layout code here
So to make that code work you would need a file called home.html and a file called guides.html
:)
IntaMedia
22-03-2008, 11:59 PM
try this:
<iframe src="widthhere%" height="heighthere%" src="URL/TO/FILE" frameborder="0" />
try that =]
try this:
<iframe src="widthhere%" height="heighthere%" src="URL/TO/FILE" frameborder="0" />
try that =]
should be
<iframe src="widthhere%" height="heighthere%" src="URL/TO/FILE" frameborder="0"></iframe>
iframe has a closing tag :]
anyway..
<?php
$page = $_GET['page'];
if(!isset($page))
{
include("home.php");//Home page..
}
else if(file_exists("" . $page . ".php"))
{
include("" . $page . ".php");
}
else
{
echo("<h1>Error..</h1>The file <strong>" . $page . ".php</strong> was not found.");
}
?>
then you'd just use this for your hyperlinks.
<a href="?page=home">Home</a>
<!-- Links to home.php -->
<a href="?page=news">News</a>
<!-- Links to news.php -->
That should do what you're looking for?
samuelb07
24-03-2008, 08:39 PM
Jme gots +rep :)
Independent
25-03-2008, 03:39 AM
try this:
<iframe src="widthhere%" height="heighthere%" src="URL/TO/FILE" frameborder="0" />
try that =]
Iframes are total crap, even though must ajax is by iframe, I prefer includes..
And you can just include .html files within php anyway?
<?php
// Include file below
include('page.html');
?>
do it by includes :) Much better
Klydo
25-03-2008, 10:21 AM
Thing is I bet you're making a radio fansites or something. If you're making a radio fansite they PHP includes are no use to you. You'll either have to use AJAX or an iFrame.
Decode
25-03-2008, 10:27 AM
Iframes are total crap, even though must ajax is by iframe, I prefer includes..
And you can just include .html files within php anyway?
<?php
// Include file below
include('page.html');
?>
Yes, but you will need a code for chaning whats included.
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.