batstanggt Posted July 28, 2011 Share Posted July 28, 2011 Hey, I may seem like a complete moron by asking this but is it possible to have php automatically create 5 separate html pages upon register? If so what would be an example of a code to do so. -SB Quote Link to comment https://forums.phpfreaks.com/topic/243057-auto-page-creation/ Share on other sites More sharing options...
the182guy Posted July 28, 2011 Share Posted July 28, 2011 You can write to files with PHP to create the HTML pages. Quote Link to comment https://forums.phpfreaks.com/topic/243057-auto-page-creation/#findComment-1248345 Share on other sites More sharing options...
WebStyles Posted July 28, 2011 Share Posted July 28, 2011 I guess you have an html template somewhere (or 5 in this case). If they're exactly the same for each user, there's really no point in duplicating them, if they're different, you probably need to change some code in each, so you would use file_get_contents() to read in the template, something like str_replace() to alter it, and then save it to another file. Quote Link to comment https://forums.phpfreaks.com/topic/243057-auto-page-creation/#findComment-1248400 Share on other sites More sharing options...
batstanggt Posted July 29, 2011 Author Share Posted July 29, 2011 Hey guys sorry for the delayed response jsut finished up 14 hour work day. Anyhow Webstyles your on the right track 5 templates for each user sounds like what im trying to accomplish more so than creating individual .html pages for each user. So how does one make that happen ? Im gunna take a shot in the dark and say URL variables? lol just a guess. Thanks guys for the help and hope you dont mind helpin me a lil more. -SB Quote Link to comment https://forums.phpfreaks.com/topic/243057-auto-page-creation/#findComment-1248874 Share on other sites More sharing options...
MasterACE14 Posted July 29, 2011 Share Posted July 29, 2011 Not really sure what you are trying to accomplish. Im gunna take a shot in the dark and say URL variables? Do you have 5 separate 'pages' and want to display one of those pages inside an existing template? If so you can do something like this... <?php require_once('header.php'); // include your Header template // URL would look like... file.php?page=something if(isset($_GET['page'])) { $page = trim($_GET['page']); } else { $page = 'home'; // set default page to load if none is specified } $page = 'pages/'.$page.'.php'; // path to pages, in this case the 'pages' directory/folder if(file_exists($page)) { require_once($page); // include the specified page if it does exist } else { require_once('pages/home.php'); // if the page doesn't exist load the default page } require_once('footer.php'); // include your Footer template ?> Regards, Ace Quote Link to comment https://forums.phpfreaks.com/topic/243057-auto-page-creation/#findComment-1248894 Share on other sites More sharing options...
the182guy Posted July 29, 2011 Share Posted July 29, 2011 Not really sure what you are trying to accomplish. Im gunna take a shot in the dark and say URL variables? Do you have 5 separate 'pages' and want to display one of those pages inside an existing template? If so you can do something like this... <?php require_once('header.php'); // include your Header template // URL would look like... file.php?page=something if(isset($_GET['page'])) { $page = trim($_GET['page']); } else { $page = 'home'; // set default page to load if none is specified } $page = 'pages/'.$page.'.php'; // path to pages, in this case the 'pages' directory/folder if(file_exists($page)) { require_once($page); // include the specified page if it does exist } else { require_once('pages/home.php'); // if the page doesn't exist load the default page } require_once('footer.php'); // include your Footer template ?> Regards, Ace Don't forget to fill in the nice big juicey local file inclusion hole in that example. Quote Link to comment https://forums.phpfreaks.com/topic/243057-auto-page-creation/#findComment-1248988 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.