php - Create simple HTML demos based on template with different URL paths -


i obtain on localhost (somehow dynamically) following urls:

localhost/demo1/ localhost/demo2/ localhost/demo3/ ... 

and on (more 30).

i have index.php file use template each of above paths.

when access localhost/demox/ load index.php template few changes inside, based on demox name.

can tell me how obtain structure? thanks

use php

1) parse site url (hint url "http://" . $_server['server_name'] . $_server['request_uri']) variable need (i think use regex that)
2) $template = require_once('index.php');
3) process variables used in index.php
4) echo $template; exit();


not tested pseudo code

$url = $_server['server_name'].$_server['request_uri']; $part = preg_match("/demo(\d+)/", $url)[0]; $partname = "file name demo-{$part}"; $template = require_once('index.php'); echo $template; exit();  [index.php] <?php echo $partname; 

Comments