2

I am trying to make a website where it starts with simple text, "Hello". Then, anyone who comes to the website can change the content to whatever they like, saving it not just for themselves but for the website itself. Then another viewer can come in and change it, and so on. I'd like to also keep a database of all edited content, but only for myself.

So my question is, what tools/languages would be helpful to this? Or can anyone point to any tutorials? I am such a beginner, that I have no clue really where to start. This seems really helpful, but it seems to make changes only for yourself.: http://www.developerdrive.com/2012/06/allowing-users-to-edit-text-content-with-html5/

Sorry if this is a very simple question that I am overcomplicating. I appreciate any help!

Helena J.
  • 105
  • 1
  • 4
  • 11
  • 3
    I think that this question is too broad for this site specifically. Of course there are a ton of ways to allow the user to edit the text on the client and similarly many ways to send data when it gets updated to the server as well as read the updated data from the server. You could do this with php, ruby -- pretty much anything. I would probably go with node.js -- especially a comprehensive live page updating framework like [Meteor](http://www.meteor.com/) – Explosion Pills Nov 14 '13 at 19:07
  • I think the OP is really just looking for pointers on where to begin. I believe we can all at least do that much. – cssyphus Nov 14 '13 at 19:30
  • 1
    While the OP is looking for pointers, it's going to take a questionnaire to figure out what the OP knows and how their mind works with languages; PHP isn't Ruby, and a site isn't designed the same way using those two. There's a huge amount of HTML/JavaScript/CSS knowledge plus PHP or Ruby, plus database design needed for this. Without that information, anything we offer is merely opinion, which puts the question way off-topic for Stack Overflow. – the Tin Man Nov 14 '13 at 19:38

2 Answers2

2

There are many aspects to your question. First, you may need a registration/login system. For that, you will need both front-end (javascript/jQuery) and back-end (PHP) programming.

If you have a login system, you should learn about PHP sessions.

You will need to read/write into a database. This would be back-end (PHP). Many tutorials currently cover only the older mysql_ commands; you must learn either mysqli_ or PDO format (as the older style still works but is deprecated).

You should learn jQuery and javascript. jQuery will be very helpful, and don't listen to those who say you must learn javascript first -- I didn't and I am now filling-in what I missed about javascript after having designed numerous sites.

There are many places to find tutorials, but I can recommend these:

  1. PHPAcademy.org - used to be free, but is now just low-priced
    Registration and Login tutorial
    PHP and MySQL with PDO and mysqli_

  2. TheNewBoston.com -- try this one:
    Project Lisa - Unfinished tutorial but very good
    Intro to PHP
    Intro to jQuery


You are correct that the example you posted only saves edits for the current user (and for future visits by that same user). The changes are saved on the user's local computer, not on the server. The easiest way to store edits on the server is to write them to a database, such as MySQL.


Here is an example of why you might prefer to learn jQuery over plain javascript:

The javascript way:

function saveEdits() {
    //get the editable element
    var editElem = document.getElementById("edit");

    //get the edited element content
    var userVersion = editElem.innerHTML;

    //save the content to local storage
    localStorage.userEdits = userVersion;

    //write a confirmation to the user
    document.getElementById("update").innerHTML="Edits saved!";

}

The jQuery way:

function saveEdits() {
    //get the edited element content
    var userVersion = $("#edit").var();

    //save the content to local storage
    localStorage.userEdits = userVersion;

    //write a confirmation to the user
    $("#update").val("Edits saved!");

}

Much less typing -- especially over an entire project -- using the jQuery way. Also, jQuery takes care of all cross-browser issues for you. With javascript you must code for each browser yourself. For most developers, jQuery is faster and easier.

cssyphus
  • 37,875
  • 18
  • 96
  • 111
0

Sounds more like a Wikipedia site. If that is what you wanted, go with open source tool/software Mediawiki. You can download it here Mediawiki

First install it locally in your system, play with it such as create, edit pages etc

Bala
  • 11,068
  • 19
  • 67
  • 120