Online edition with TinyMCE
Using TinyMCE, you can directly create web pages on your site by logging in to any computer. Create static pages using a template, a reusable template into which the content of a written article is inserted.
Choosing a template from the list for each article or changing it to an already published article is even quite simple - an option ignored by most CMS, although useful for contextual design.
We chose one of the most popular online publishers - TinyMCE. It is written in JavaScript and runs on a browser. He can fit into the CMS and is the default Wordpress editor. We will associate it with scripts designed to integrate new pages on the site. Ideally news.
Although this article is primarily pedagogical, it is accompanied by a complete enough demonstration to be functional and usable on your site. Then we will develop a more professional product... But also free.
This demo from the beginning has a tool for creating URLs consisting of keywords to optimize the site for search engines, while some widespread CMS, such as Joomla, can only do this with a plugin!
How does it work
The page creation system consists of the following files:
- TinyMCE, the latest version of the standard distribution.
- An editor that is an HTML page that includes TinyMCE and various added form fields.
- store.php is a PHP script that creates HTML pages.
- retrieve.php - a script that contains information on HTML pages for editing.
- anaa.js is an Ajax mini-framework that allows you to continue editing an article after saving it.
- titleconvert.php is a script for creating a URL from the title of an article. And
- a few template examples.
Principles
TinyMCE works by associating editing functions with a form object, a text area. Other form objects are added to this demonstration for title, template selection.
A template is an HTML or PHP page that contains markers for inserting title and text:
For the name of the PHP variable:
<?php title="montitre"; ?>
For layer content:
<div id="content">
</div>
It will be easy to create a new template from the proposed template.
When the user clicks the Save button, the values or content of the form objects are passed to the store.php script by the Ajax script. The PHP script does the following:
- It calls the titleconvert.php script to create the URL.
- It loads the pattern whose name was given to it by writing it under the filename generated by titleconvert, a name that is a sequence of keywords without accents or uppercase letters.
- Instead, the title and text of the article are inserted.
- The article is then published and must be linked to the homepage.
Edit an already published article
To resume information on an already published page, the same powerful rational expressions are used as for storing data on a new page formed by a copy of the template.
The advantage of this system is that our online editor does not need to store texts either in the database or in XML files, they are stored directly on the pages and repeated on the pages for editing .
Future developments
In order for this tool to be used in production, it must be designed and have at least one list of published articles to facilitate its editing. You also need to automatically link articles on the home page of the site.
Software like Wordpress only links recent articles on the home page. Such a solution is easy to implement.
In addition, you can add many tools to it: RSS stream generator, sitemap, etc. This will be the subject of further publication.
It is also possible to connect the editor to the database not for the content of articles, but for related information such as categories, tags, etc. This can also become the subject of another demonstration .
Using the demo
- Extract the content from the archive and post it to your site.
- Launch install.php to create a login and password.
- It will then be automatically deleted. You must download this file again to use it later.
- Run editor.php
- Enter the title and content, select the template (they are all identical in the demo).
- Add article link to homepage.
Download Scripts
The archive contains the TinyMCE distribution, PHP scripts, and sample templates .
- Archive. Updated January 27, 2011.
- TinyMCE to make sure you have the latest version. But to replace it, you need to change the page in the HTML editor.
MCE Editor Installation Question
Claude
webmaster
Claude
webmaster
$ulogin= $_SESSION["login"]; $upass= $_SESSION["password"];So the $ _ SESSION variable is not initialized, and the session is not open, which can be checked with the $ _ SESSION dump. Does your configuration support sessions? Security integration is necessary because some users can use the software as is.
Claude
Display text color
webmaster
$n = file_put_contents($filename, $body);You can add a parameter to force binary mode...
$n = file_put_contents($filename, $body, FILE_BINARY );Similarly, the loading function in retrieve.php can be changed:
$content = @file_get_contents($page, FILE_BINARY);I cannot check it, as for me the content is honestly returned.
Nicko
Nicko
webmaster
$content = urldecode($a["content"]);becomes:
$content = $a["content"];You also need to know if the text has already been changed in the saved file or when overwriting it. To do this, you need to see the contents of the file in the editor.
Nicko
Nicko
webmaster
$body = $head.'<div id="content">'.$content.'</div>'.$parts[1];In this case, it would be better to use the stripcslashes function after rebooting via retrieve.php
$content = @file_get_contents($page); $content = stripslashes($content);
Nicko
Nicko
webmaster
Nicko
webmaster
$n = file_put_contents($filename, $body);by:
$nfile = fopen($filename, 'w'); $n = fwrite($nfile, stripslashes($body)); fclose($nfile);I will post a new version.
Nicko