Holo, you need to read from the default page (Template page) and create a file of the same page in another directory. I would be grateful, I tried to solve this problem myself, but it turned out. Here is the govnod (bydlokod):
<?php $file = "pages/".$row['name']; $str = htmlentities(file_get_contents("defaultpage.php")); if (!file_exists($file)) { $fp = fopen($file, "w"); fclose($fp); } ?>