I am aware there are more topics on this matter, I've read them, but I did not found the answer.
I have an index.php, that contains a bunch of .php includes: header.php, navigation.php, box.php, footer.php, and inside the "pages" div, I have the one that needs to be different (based on the links from navbar.php or box.php).
navbar.php example:
<a href="index.php?v=pag1.php">Page1</a>
<a href="index.php?v=pag2.php">Page2</a>
index.php:
<div id="wrapper">
<div id="header">
<div id="topbox">
<?php include ("box.php"); ?>
</div></div>
<div id="content">
<div id="bara">
<div id="navbar">
<?php include ("navbar.php"); ?>
</div>
</div>
<div id="pages">
<?php include ("$v"); ?>
</div>
</div>
<div id="footer">
<?php include("footer.php"); ?>
</div>
</div>
I have a $v='pag1.php', $v='pag2.php' , etc on each page I want to include, but I get "undefined variable" error "Undefined variable: v in C:\wamp\www\test\index.php on line 39"
If I define the variable $v inside of index.php, it works, but that means I will have to create duplicates of index.php, and kinda defeats the purpose. I only want pag1.php, pag2.php, pag3.php, etc to be included in index.php, not to create a lot of copies. I can use html for that :)
I know I probably ask a stupid question, but I'm a newbie in php, and I have no idea where to look for answers. Thank you in advance.