php page inside a php page.

Now, I’m very new to php, most of my experience has been downloading scripts and moding them using guides. I’m currently making a new website, I got the mysql databases built up and working. but im trying to build my navigation menu. I had at one time a little php code that would load a php page inside of another for example, If I had a news button on the site then the link would look like (   HOME ) then there was a little php code i would place in the area of the webpage I wanted that page to pop up but I cant remember what it was I think it was something like ( <?php include('?b.php'); ?> ) but obviously that isn’t working. any help would be much appreciated.

Hi there,

I think what you are looking for is a setup similar to this (i have removed actual content and just put the important parts):
URL:www.mysite.com/index.php?page=news

[code]

<?php $pagereq = (isset($_GET['page']) && trim($_GET['page']) != "") ? trim($_GET['page']) : ""; if(!empty($pagereq) && file_exists($pagereq.".php")) { include $pagereq.".php"; } else if(!empty($pagereq) && !file_exists($pagereq.".php")) { include "errors/404.php"; } else { include "home.php"; } ?>
[/code]

Let me know if this helps or not and whether or not you need any help implementing it to your current code.

the news (which are in unicode form) must get collected at one place and converted in …rtf format so that after getting downloaded and when used again by unzipping them…
there should be no issue of fonts compatibility.

ahsan

<?php include("templates/header.php"); // Set the default name $action = 'index'; // Specify some disallowed paths $disallowed_paths = array('header', 'footer'); if (!empty($_GET['action'])) { $tmp_action = basename($_GET['action']); // If it's not a disallowed path, and if the file exists, update $action if (!in_array($tmp_action, $disallowed_paths) && file_exists("templates/{$tmp_action}.php")) $action = $tmp_action; } // Include $action include("templates/$action.php"); include("templates/footer.php");
Sponsor our Newsletter | Privacy Policy | Terms of Service