0

I m not sure if thats right section, but I m pretty sure it's done with PHP. So the question is, how can I change a conetent inside a division without navigation to new page. For instance I have 4 division. Header, links, content, footer. Now if i click some link on links division then the content division would change its content, but all the other pages remain same and the page URL would also stay the same. I know it could be done with

<php include('page.php') ?>

but this would still expect me to open a new page. I hope I didnt express myself too messy.

<html>
<head>
</head>
<body>
<div id="header">

<div id="navigation>
<a href="TriggerContentChange.php">Link</a>
</div>

</div>

<div id="content">

<!-- I need this division to change content when I click on link, but the page has to remain the same -->

</div>

</div id="footer">

</div>

</body>
</html>

Regards,

Martin

2
Contributors
1
Reply
3
Views
5 Years
Discussion Span
Last Post by diafol
0
<?php 
$defaultpage = "main";  
$page = (isset($_GET['page']) && in_array($_GET['page'], array(...list of pages...)) ? $_GET['page'] : $defaultpage;
?>
<html>
<head>
</head>
<body>
<div id="header">
 
<div id="navigation>
<a href="TriggerContentChange.php">Link</a>
</div>
 
</div>
 
<div id="content">
 
<?php include('content.php');?> 
</div>
 
</div id="footer">
 
</div>
 
</body>
</html>

You could do something like this. It's a bit rough and reaady. The content.php page will accept a $page variable and using a switch condition will load the appropriate data. 'main' is the default page if no page is set or the page does not exist.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.