Elite Diviner
- Joined
- Aug 15, 2008
- Messages
- 489
- Reaction score
- 43
<a href="#" target="_self">123</a>
Code:<a href="#" target="_self">123</a>
Like a php ?act=pagename function?
So when you click on a link the page appears in the main box on your webpage?
I'm pretty sure that can be done with AJAX or even just Iframes.
, anyway, can someone explain me how it works?
EDIT: Can it be done like on click it opens a home.php to my <div "item">here</div>
<iframe name="main" src="home.html">Your browser doesn't support iFrames! Get firefox n00b.</iframe>
<a href="info.html" target="main">Info</a>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="./js/jquery.js"></script>
</head>
<body>
<div id="sitecontainer">
<div id="banner"></div>
<div id="leftmenu">
<a href="#" class="Index">Index</a><br />
<a href="#" class="Downloads">Downloads</a>
</div>
<div id="content"></div>
<script type="text/javascript">
//jQuery
$(document).ready(function() {
$('.Index').click(function() {
$('#content').load('./pages/index.php');
});
$('.Downloads').click(function() {
$('#content').load('./pages/dl.php');
});
});
</script>
</div>
</body>
</html>
<?php
$page = $_GET['src'];
if($page) {
$link = "inc/{$page}.php";
if(file_exists($link)) {
include($link);
}else{
echo "Page could not be found.";
}
}else{
include("inc/home.php");
}
?>
You could use this code I just made, if I get what you're saying..
This PHP code will allow you to put content on the page, without having to create a new page.
PHP:<?php $page = $_GET['src']; if($page) { $link = "inc/{$page}.php"; if(file_exists($link)) { include($link); }else{ echo "Page could not be found."; } }else{ include("inc/home.php"); } ?>
Simply put your content in inc/, and make sure it's a php file. Then put the code above in your index.php file, where you want the content. Last thing you have to do, is figure out the url. The url for a page would be index.php?src=(PAGE NAME HERE). Also, if you leave the url as just index.php, it'll go to your homepage content.
I'm not sure if I were misunderstood, but this is somewhat what I ment:
Code:<!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <script type="text/javascript" src="./js/jquery.js"></script> </head> <body> <div id="sitecontainer"> <div id="banner"></div> <div id="leftmenu"> <a href="#" class="Index">Index</a><br /> <a href="#" class="Downloads">Downloads</a> </div> <div id="content"></div> <script type="text/javascript"> //jQuery $(document).ready(function() { $('.Index').click(function() { $('#content').load('./pages/index.php'); }); $('.Downloads').click(function() { $('#content').load('./pages/dl.php'); }); }); </script> </div> </body> </html>
This loads a php document into the "content" div and that was what I ment to be a little hard to get a specific url for the file being loaded upon load.
But the thing with iFrame seems a lot quicker and more noob friendly than this.
bad bump should of have quoted this and made a new thread. well what ever