Connecting Tech Pros Worldwide Help | Site Map

How to make my web page editable..

Newbie
 
Join Date: Jul 2008
Posts: 11
#1: Sep 17 '08
Hello,

I have developed one web site, In that i want to add a tool for viewers to edit the current page.

For example in wikipedia there having one tool for edit This page(sand box), here is the Link for that edit page.

http://en.wikipedia.org/w/index.php?...ge&action=edit

help me to slove this.
Atli's Avatar
Moderator
 
Join Date: Nov 2006
Location: Iceland
Posts: 3,741
#2: Sep 17 '08

re: How to make my web page editable..


Hi.

How is the data on that page stored?

If it's a simple HTML page, you could just fetch the content of that page using a function like file_get_contents, display it in a <textarea> and the save it again when the user submits it.
Newbie
 
Join Date: Jul 2008
Posts: 11
#3: Sep 17 '08

re: How to make my web page editable..


Quote:

Originally Posted by Atli

Hi.

How is the data on that page stored?

If it's a simple HTML page, you could just fetch the content of that page using a function like file_get_contents, display it in a <textarea> and the save it again when the user submits it.

HI

Thank's for your kind reply.

But i dont want to put the file content.My query is , for ex: There is one line of mathematics equations and in that forum if any body want to add a line about that equation i should let them add.
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,936
#4: Sep 17 '08

re: How to make my web page editable..


Quote:

Originally Posted by vivekshekar

HI

Thank's for your kind reply.

But i dont want to put the file content.My query is , for ex: There is one line of mathematics equations and in that forum if any body want to add a line about that equation i should let them add.

Is your webpage content coming from a Database?
Atli's Avatar
Moderator
 
Join Date: Nov 2006
Location: Iceland
Posts: 3,741
#5: Sep 17 '08

re: How to make my web page editable..


So you want people to be able to add text into a static HTML file?
Something like a comment system you might find on a blog.

The simplest way would probably be to have a HTML file that contains a placeholder of sorts, where you want new lines to be added.
Then you could load the entire file into your PHP code and replace that placeholder with the new line, adding a new placeholder after that line, and finally overriding the old HTML file with the new one.

That wouldn't be hard to implement, and would just require basic knowledge of PHP.
Look into the file_get_contents, str_replace and file_put_contents functions if you want to try it out.

That is, obviously, not the best way to do this, but is is the simplest.
Other, more refined methods, would involve some sort of a database, and a PHP code that would assemble the page on each request (or possibly create a cached file... but that's a while another issue).
Newbie
 
Join Date: Jul 2008
Posts: 11
#6: Sep 20 '08

re: How to make my web page editable..


Quote:

Originally Posted by Markus

Is your webpage content coming from a Database?

yes it's content coming from Database...
Newbie
 
Join Date: Jul 2008
Posts: 11
#7: Sep 20 '08

re: How to make my web page editable..


Quote:

Originally Posted by Atli

So you want people to be able to add text into a static HTML file?
Something like a comment system you might find on a blog.

The simplest way would probably be to have a HTML file that contains a placeholder of sorts, where you want new lines to be added.
Then you could load the entire file into your PHP code and replace that placeholder with the new line, adding a new placeholder after that line, and finally overriding the old HTML file with the new one.

That wouldn't be hard to implement, and would just require basic knowledge of PHP.
Look into the file_get_contents, str_replace and file_put_contents functions if you want to try it out.

That is, obviously, not the best way to do this, but is is the simplest.
Other, more refined methods, would involve some sort of a database, and a PHP code that would assemble the page on each request (or possibly create a cached file... but that's a while another issue).

Thank u so much........
Ill try this out. If i got any doubt help me like this only...
Reply