Page 1 of 1

Can I use PHP for coding this type of site?

Posted: Tue Jun 15, 2010 9:05 pm
by myraedom
I am creating a site that requires users to login and then they will be able to choose a website template. Once template is chosen they will enter information that will get inputed to template and a sub-site for them is created within my site. I am wondering if I can use PHP coding to do all this? How hard will it be to code this? Please help I am still learning.

Re: Can I use PHP for coding this type of site?

Posted: Tue Jun 15, 2010 11:31 pm
by califdon
Yes, that's typical of what PHP scripts do. For someone with years of experience, it would be a substantial, but basically routine task. For a beginner, I wouldn't recommend it.

Re: Can I use PHP for coding this type of site?

Posted: Wed Jun 16, 2010 6:12 am
by Phoenixheart
You may want to have some templates with placeholders, eg. {NAME}, {EMAIL} etc.
Then when the user provides the data, replace them into those placeholders. Just from top of my head:

Code: Select all

// get the whole template into a string
$str = file_get_contents('template.html');

// replace placeholders with data
$str = str_replace('{NAME}', 'John Doe', $str);

// create the subfolder
mkdir('john_doe');

// write the template into the subfolder
file_put_contents('john_doe/index.html', $str);
Of course this is very very basic, you'll have to play around with it. As califdon said, this is not really a beginner's task.

Re: Can I use PHP for coding this type of site?

Posted: Thu Jun 17, 2010 1:25 am
by myraedom
Thanks Guys, I think I will review my php skills a little first. Possible take more classes. But thanks so much for the help. I was stumped trying to figure out how some sites did it. But hey I'm learning. Thanks so much. :D