php - Call from template with $_GET -


so i'm trying make own template site it's easy use , i'm trying figure out how include different paths.

currently have below nested inside of body navbar.php

<? include 'content.php' ?> 

what i've tried is

<? $_get["path"]; include "$_get" . ".php"; ?> 

i want change out content.php have less static pages. assume above isn't safe. alternative this?

if want make more secure, can use array checking includes pages:

<?php     $validpages = array('content', 'home', ...);      if(in_array($_get['path'], $validpages)) {         include($_get['path'].".php");     } ?> 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -