DeCarlo Posted November 1, 2011 Share Posted November 1, 2011 Hello Coddy Guys,im trying to do simple website creator Maybe i don't have Disease Centres probably do not have the imagination to do or something else. I wan't to do. when member is registered and he got template that chosed in registration. how to create new folder with users template. Maybe you got it. Thanks. Quote Link to comment Share on other sites More sharing options...
Adam Posted November 1, 2011 Share Posted November 1, 2011 Not entriely sure what you're asking (I'm guessing English isn't your first language?) but you should look into mkdir. Quote Link to comment Share on other sites More sharing options...
DeCarlo Posted November 1, 2011 Author Share Posted November 1, 2011 um yes,member register and creates files example template? how to improve this?. Quote Link to comment Share on other sites More sharing options...
Adam Posted November 1, 2011 Share Posted November 1, 2011 Sorry can you be more specific? Quote Link to comment Share on other sites More sharing options...
DeCarlo Posted November 1, 2011 Author Share Posted November 1, 2011 i wanna say when member is registered the function creates files example template file,folders ant etc.Is this ok? Quote Link to comment Share on other sites More sharing options...
xyph Posted November 1, 2011 Share Posted November 1, 2011 You shouldn't create a file each time a member registers. Instead, you should have one file that takes the users ID in the query string, and displays the details you'd like based on that ID. Check out the $_GET superglobal array. Then again, you may actually need a user to have his/her own folder, in which case Adam's posts will be relevant. Quote Link to comment Share on other sites More sharing options...
DeCarlo Posted November 1, 2011 Author Share Posted November 1, 2011 and how it should look like? <?php include_once('include/database.php'); include_once('process.php'); mkdir("/v1.5/".$_GET['reguname']."/", 0700); file_get_contents('index.txt'); ?> like this? just without get superglobal Quote Link to comment Share on other sites More sharing options...
ZulfadlyAshBurn Posted November 2, 2011 Share Posted November 2, 2011 Let me get this right, are you allowing your users to choose the template or there is only one default template? Best way is to create a folder for each user and copy the files to it. If the there is only one template, <?php // includes your necessary files include_once('include/database.php'); include_once('process.php'); // Gets the username $user = $_GET['reuname']; // specifies the folder where you want the folder to be created & the user folder. $folder = "thefolder"; $userfolder = $folder . "/" . $user; // makes the directory and copy the template. mkdir($userfolder); // specifies the template location. $template = "template/default.php"; // specifies the index file for the user. $userfile = $userfolder . "/index.php"; copy($template, $userfile); ?> Quote Link to comment Share on other sites More sharing options...
DeCarlo Posted November 2, 2011 Author Share Posted November 2, 2011 thanks for the reply, i want allow users to choose the template. and he can edit text or change imgs. Quote Link to comment Share on other sites More sharing options...
ZulfadlyAshBurn Posted November 2, 2011 Share Posted November 2, 2011 If you want the user to be able to choose the template. just change the template. <?php // includes your necessary files include_once('include/database.php'); include_once('process.php'); // Gets the username $user = $_GET['reuname']; // specifies the folder where you want the folder to be created & the user folder. $folder = "thefolder"; $userfolder = $folder . "/" . $user; // makes the directory and copy the template. mkdir($userfolder); // get the template and specifies the template location $template = "template/" . $_GET['tpl'] . ".php"; // specifies the index file for the user. $userfile = $userfolder . "/index.php"; copy($template, $userfile); ?> Quote Link to comment Share on other sites More sharing options...
trq Posted November 2, 2011 Share Posted November 2, 2011 Creating a new directory for each new user is probably not the best way of doing this. You need to explain in detail what exactly it is your trying to do. Quote Link to comment Share on other sites More sharing options...
DeCarlo Posted November 2, 2011 Author Share Posted November 2, 2011 Ok or maybe i can do with wildcard user gets 2nd domain like james.qwerty.com,and then users register gots template he can edit template Texts and something more. i see in future that user can turn and turn off some advances. Thanks for the replays. Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 2, 2011 Share Posted November 2, 2011 Best way is to create a folder for each user and copy the files to it. I disagree. Let the user choose their template from a list of available templates and store the selection. Then you can dynamically include() the correct template at run time. No need to copy identical files all over the server. Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 2, 2011 Share Posted November 2, 2011 DeCarlo, no need to pm me to ask a question regarding a response I have made in your thread. Just ask your question in the thread. Anyway, the process of implementing what I suggested above is very simple. When you register the person you would have to store their information some where. I will assume you are using a database. In that database you simply create a field to store the template the user selected during the registration process. You can either store the actual file name of the template they chose or create a table in the database for the template info and then you would store the ID of the template they chose. There are benefits and drawbacks to both methods. Then when the user logs in you can retrieve their selected template from the database and store the name in a session variable. Then use that session variable wherever you need to use the template. Quote Link to comment Share on other sites More sharing options...
ZulfadlyAshBurn Posted November 3, 2011 Share Posted November 3, 2011 The reason I copied the files over is so that the user can edit the template. Quote Link to comment Share on other sites More sharing options...
trq Posted November 3, 2011 Share Posted November 3, 2011 The reason I copied the files over is so that the user can edit the template. That is probably easier done from a database too. Quote Link to comment Share on other sites More sharing options...
DeCarlo Posted November 5, 2011 Author Share Posted November 5, 2011 Ok ill try to work.thanks to all Quote Link to comment 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.