Hello I am very new to PHP.

I want to make it so i can edit a certain div in an HTML page using a WYSIWYG editor such as TinyMCE. Is there a way to do it so lets say I have a list of all the pages on my website and I want to edit one, I click on it and shows up an editor with what is currently displayed in the content div and I can edit it. Then you would press submit and it would write it the HTML document.

Is this possible? If so how would I go about making it. Can you give me directions or something that shows me how to do this?

I don't want to use MYSQL or JavaScript to show the content. So basically a person can view the page without JavaScript enabled.

Thank You.

Recommended Answers

All 5 Replies

The best way I know would be to use a database.
You can look into the file functions in PHP, fopen, fread, fwrite etc... But I would use a database over this any day.

Also, about this:

I don't want to use MYSQL or JavaScript to show the content. So basically a person can view the page without JavaScript enabled.

Hate to break it to you, but TinyMCE uses a lot of JavaScript, take a look at their examples page (http://tinymce.moxiecode.com/examples/full.php) with JS turned off.

Its not i don't want to use Javascript to update the website but for people to view the website. I talked to someone saying that one, and a easy way to get updated content to display on the site is via JavaScript and i did not want to.

So using JavaScript to update a website: OK
Using JavaScript to view website content: Not Ok

So is the only other reasonable way of doing it a database? And when you say database you mean MySQL?

The problem is: I am not against using MySQL but the server i will be on may not have it and i dont know if i can install it. So Any other ways of doing this would be great. And if not how would you do it with MySQL? (Also how hard is it to install, Example: harder then or easier then PHP)

MySQL is straight forward to install and use. I use TinyMCE/PHP(sometimes ASP)/MySQL(sometimes Access) to create/edit/delete web pages and find it fantastic combination.

If you can't use MySQL or any other database then you can use text files to hold the data.

You will need to set permissions on the files/directory. If the files need to go into the root then create/edit them in another directory and use PHP ftp functions to move them.

Hope this helps ...

Simon.

Member Avatar for diafol

I'm confused. Why bother asking about the js in the first place? It's your choice as to how the data is presented. Vanilla html via php is fine. No need for any js. As for storage - using files is messy but possible. Dbs are much better. BTW I use spaw2 as an online text editor, it's lightweight compared to tinymce and fckeditor and has a great free file management feature. Spaw2 from solmetra.

Can someone direct me to a tutorial of how to do it with and without MySQL? I am not exactly sure what I am searching for.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.