Hi Guys.. Merry Christmas
Im kinda new to this fantastic world of PHP and i have a little problem i hope you can help me with.
Im trying to build a website where I use include() to genereate my content. On my index.php i have a menu which includes
content in a content div from external .php pages, my structure kinda goes like this.. (simplified)
site/
index.php
content/
fronpage.php
products.php
contact.php
The HTML looks like this.
<div id="menu">
<ul>
<li><a href="index.php?page=frontpage">frontpage</a></li>
<li><a href="index.php?page=products">frontpage</a></li>
<li><a href="index.php?page=contact">frontpage</a></li>
</ul>
</div
<div id="main">
<?php
include('/content/'.$_GET['page'].'.php');
?>
</div>
This all works very fine, but my problem is, can I have a include inside an already included page?
I would like to have a menu on my products.php site, but that page is already included from above,
and i would like the menu on the products.php site to stay as the content from the nested include
changes with input from the /products folder.
my idea was something like this.
site/
index.php
content/
frontpage.php
products.php
contact.php
products/
product1.php
product2.php
the HTML on the index.php is the same as above and then i would add the include() on the
products.php page, so its kinda the same thing, but one inside the other.
HTML inside the products.php folder
<div id="sub_menu">
<ul>
<li><a href="#">frontpage</a></li>
<li><a href="#">frontpage</a></li>
<li><a href="#">frontpage</a></li>
</ul>
</div
<div id="sub_main">
<?php
include('/content/products'.$_GET['#'].'.php');
?>
</div>
I dont know how to link to the new files so they will be included while the first include still stays on the page.
Any of you know how and if this can be done? Or maybe at better way to do it?
Hope this made sense, my first PHP question
Thanks