Code with C | Programming: Projects & Source Codes › Forums › PHP › Dynamic content in php by switching it out with other PHP file
Hey guys is there a way to to make your main content block dynamic, by switching it out with other .php files instead of including your header, footer and navigation on each php page? Or is including the header, footer, and nav the prefered way?
Plus if the content is dynamic will the page address that switches out the content change? If not will that mean if someone directly types or guess your dynamic page (i.e page.php), it’ll load on its own instead of popping up under the same parent page that calls it dynamically?
With including the same content on each page, keep it DRY and use includes to insert content to the page. So you could have a base.php page with:
$content = "index.php";
You must be logged in to reply to this topic.