Page 1 of 1

Stop reloading the whole page.

Posted: Fri Apr 29, 2011 5:06 pm
by Pavlos1316
My index.php:

Code: Select all

<body>
<div id="header">
<?php include('header.php'); ?>
</div>
<div id="content">
<?php
	$page = $_GET['page'];
	if (!empty($page)) {
		$page .= '.php';
		include($page);
	}
	else {
		include('arxiki.php');
	}
?>
</div>
<div id="footer">
<?php include('footer.php'); ?>
</div>
My <div id=header> link:

Code: Select all

<a href="index.php?page=body" class="difflink">Body</a>
I use this code to open the link BODY which is in my <div id=header> into my <div id=content>.
BUT when it happens my whole page gets reloaded. How can I stop this and have only my <div id=content> reloaded?

Re: Stop reloading the whole page.

Posted: Sat Apr 30, 2011 6:52 am
by oscardog
Why wouldn't you want the whole page to reload? It looks like a CMS-style setup, albeit it a simple one.

If you don't want the page to reload you'll either need to use an iFrame, and simply reload the content in that iFrame or use AJAX.

Re: Stop reloading the whole page.

Posted: Sat Apr 30, 2011 1:47 pm
by califdon
It depends on what is in those page files. If each one has a header and/or an HTML or BODY tag, of course it's going to reload, since that's what you're asking it to do. If those files contain nothing but HTML to be placed within the content DIV, I don't see why it would reload.