I am building a tool that runs on my localhost that helps to put static webpages together a little faster. Security is not an issue since this is only going to run locally.
First I have an include file called components.php file with variables for page sections like this:
$slide="Pretend this is markup for a Slider";
$port="Pretend this is markup for a set of portfolio images";
$para="<p>Just another paragraph</p>";
$h1="<h1>This is a Header</h1>";
Then my url looks like this:
//only calling 3 of the 4 sections
localhost/mysite/index.php?sections=h1-slide-para
And my index file has this:
include 'components.php'
$sections = @$_GET['sections'];
$section = explode($sections,"-");
foreach ($section as $row){
echo $row;
}
The goal here is to build the components.php file up with rows I am always using so I can quickly throw page layouts together right from the address bar of my browser. I am just not sure how to echo the variables once I explode them so that index.php contains only the markup I have called from the components.php file.
components.phpfile with your$_GETvariable ?$rowas variable variable.explode($sections,"-");should beexplode('-', $sections);