Can I use PHP for coding this type of site?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
myraedom
Forum Newbie
Posts: 2
Joined: Tue Jun 15, 2010 9:00 pm

Can I use PHP for coding this type of site?

Post 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.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

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

Post 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.
Phoenixheart
Forum Contributor
Posts: 123
Joined: Tue Nov 16, 2004 7:46 am
Contact:

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

Post 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.
myraedom
Forum Newbie
Posts: 2
Joined: Tue Jun 15, 2010 9:00 pm

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

Post 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
Post Reply