Welcome Guest, Not a member yet? Register   Sign In
(newbie) User generated pages

Sorry, this is really a newbie question. I need to do an application which allows a registered user to create a page with a certain URI (which can be a subdirectory of the main page) with some content in it and a chosen url segment. I'm not sure how to proceed.
Here's what I thought:

- when you create the page, you store in the DB all the information regarding the page, plus the chosen url segment.

- when you access the page you pass the url segment as a parameter, the controller fetches all the data from the DB through the model and calls the view to generate the page.

Is this appropriate? Is there a better method to proceed?
Thank you!

First of all you have to set up your routing to handle these user added urls (tip : use title_url from the url helper to make sure users don't fumble over disallowed characters in the url).

Then your idea is fine
Quote:- when you create the page, you store in the DB all the information regarding the page, plus the chosen url segment.

The second part is a bit tricky. I guess you don't want to break the site design so the user input is limited to the main content part and some options you offer to personalize the page(s). I recently did the same and i did it as follows

- a section where the users can add/delete their pages, set the online status
- a page that shows the options + the content of the page in an editor(s) so they can update.

When they add a page i create a file for the content in a public directory so if they want i can give them direct access to their generated content. If they update the page the content gets generated according to the parser the admin has chosen (textile,wiki,bbcode). The options are added to a template that is set up by the admin.

Because my cms is driven by user added pages i set the routing very general and added the special urls (admin) before that general routing but if you want to incorporate it into a site you have to think about creating a special user added pages section (pages would be the most generic)

To sum it up, it's not really a newbie question there has to go a lot of thought into setting up a thing like this Smile

You could create a controller to access the page:

For example:

Theme © iAndrew 2016 - Forum software by © MyBB