views:

51

answers:

2

So I want my users to manage the site content themselves. For example when a customer/visitor is on the site, they see the content (each page content or paragraph stored in a database). If an employee is on the site, they should be able to login (or LDAP integrate) and for every <p> or <div> they should see a little edit icon next to it. When they click it, it turns the paragraph into a rich textbox where they can edit the content themselves.

This is something I've been thinking of for a while now but have never implemented and would like to try. Is there some tutorials or books I can start with? I can do this in either php or asp.net (mvc).

+2  A: 

The concept is not complicated, here's how I see it:

-When the user click on the edit icon, in javascript it takes whatever html code is inside the specified "div", replace it with a text box (an html editor like tinymce would be even better) and place the existing html inside it.

-When the content has been edited, it should have a submit button. On submit it should make an ajax call to a server-side function that would save the content in your database.

-The last step would be to refresh the whole page or just the modified section via another ajax call.

Here's a plugin for jquery that would simplify your work: http://www.appelsiini.net/projects/jeditable

and here's the demo (simply click on the text to edit it): http://www.appelsiini.net/projects/jeditable/default.html

You could also implement a drag and drop function, so the users can place the "div" where they want.

Hope it helps

Lobsterm
A: 

Based on your back-of-napkin design outline, you will want to consider the following questions:

  • How does a user create an entirely new page? Will this be a function of the CMS?
  • How does a user add a new block to a page, and position it where they want?
  • How does a user edit multiple blocks? Will this be important?
  • How is your data stored so that block-level editing is possible?
  • Will you have any revision history, editorial process, etc.?
  • Will there be any conflict resolution for simultaneous edits?

Ultimately, the technology you use won't make a huge difference, so go with what you are most familiar with or what is easiest/cheapest for your infrastructure. Look at other CMS systems for ideas. (Note that, just because a popular CMS does something a certain way, doesn't mean that it's a good idea. Just saying...)

GalacticCowboy