Creating a CMS
Step by step we will describe how to build a content management system that uses PHP as a programming language, and XML or MySQL to store data. This is not a simple textbook, but a specific project for building a tool that can be used in production.
Contents
Why build a CMS
?Hundreds of free CMS are available, so why build another one then?
This project is different in that we want to both build a tool and explain how you can build a tool. We believe that web applications will begin to replace locally running ones, as well as replace regular websites consisting of pages written in an HTML editor. Now websites tend to be more and more developed and made up of cutting edge technology and we need to know how these tools work.
Replacing office software with web applications does not mean that in the future we will work online, but that we will use applications that are built for the Internet: they can also work locally.
Another reason to find out how CMS is built is that the tools currently offered are only for publishing documents, if we want to do special data processing before publishing them, we need our own software.
Final CMS interests
Once completed, this CMS will allow any user to add content to the site without any knowledge of the technologies used to operate it. Authors will be able to write articles in the wysiwyg editor (not the notorious bbCode), and the webmaster will be able to manage articles, comments, news, etc. without additional knowledge.
Preliminary requirement
The program requires the programmer to:
- hosting that supports PHP for demo testing,
- HTML editor,
- Script compiler for generating the largest parts of PHP code,
- and, optionally, licensed LGPL libraries for CMS expansion (for example, using a forum).
The site webmaster only needs PHP hosting and MySQL to install the final CMS.
How to Build a CMS: Design
We launched a project that is both a textbook and a really functional tool. We will add tool after tool and everyone will come with a textbook explaining how it is implemented, how it works and how to expand their capabilities.
The final CMS will consist of a set of modules that will take over the following functions:
- Articles are edited by an external wysiwyg editor.
- The exchange with the server will take place in Ajax (not a surprise!).
- CSS is used for CMS presentation and templates.
- Texts are processed to fill the template, and then written directly to HTML files, not to the database.
- Management information is stored in XML or JSON.
- User information must be stored in encoded XML or in a database.
- Readers will be able to add comments to each article. They can be embedded in an HTML page (with dynamic on-demand display) or saved as an additional XML file.
- Members may also suggest articles. The latter will first be stored in the "offered" category.
- RSS, forum/FAQ, news and reference books will be added as extensions.
Creating a blog
Formally, a blog is a web page listing chronologically reversed bills. The main difference from the portal site is that several texts are displayed on one page, but if we can set the number of tickets per page, Just put this number at 1 to convert the blog to a portal if a constant part describing the content of the site and associated with it is displayed next to the main page.
The blog should also have dedicated text search tools and opportunities for visitors to add comments, which we intend to include in our CMS.
About Components
Most of these components are independent and can be processed in any order.
Add a wysiwyg editor to create pages
We must be able to compose articles with the help of a publisher, on any computer online, after the password is given.
Pages are not stored directly, but are processed by a translator who fills the template with text entered by the webmaster or participant.
Menu management
The created pages should not remain orphaned. A link must be created in the file. We should be able to create menus with categories and subcategories and add a link to each new page coming to the site.
The name of the category is specified when entering text, and you can also edit the menu.
Member Authentication
The form will allow you to enter a username and password before adding content to the site. If the site includes multiple members, the manager grants permissions and saves profiles. It is advisable to use MySQL.
Include comments on articles
Readers will be able to post comments and add responses to comments from other Internet users. This turns the site into a forum and requires some kind of management. The administrator must be able to delete comments. We need to build a system to store comments, display them as a list or tree that can be opened or closed (for example, directories). XML is well suited for this kind of structure.
Administration
To manage the system, we need to create an administrative panel:
-Create or edit articles
- delete articles or comments,
-user management,
- set up the system.
RSS
An RSS feed must be created to select pages or recent articles added to the site. It will work as the first list released for the first time, with the oldest titles removed to make room for the latter.
Sitemap
The site map will be created automatically. Ideally, the map will be updated as soon as a new article is created. In fact, since the standard sitemap is an XML file, the article manager, which is accessible from the dashboard, can directly use this XML file to store a list of articles.
Code
- Use Template. Create an article and insert it into a site-specific page template.
- Online edition with TinyMCE.
A complete and functional demonstration of using an online editor with scripts to store content on HTML pages. - Online edition with CKEditor
Like the TinyMCE demonstration, it contains scripts for saving or editing a file, automatically creating a file name, and using various templates. - Dynamic menu. This component displays the menu described in the JSON file. An entry is added to the JSON file for each new page created (a component will come for this). Later we will build an interface for editing this file.
- Got feedback. Allow visitors to add comments to pages. The script works on its own or as part of the final CMS.
- Login and record. Visitors must register before adding comments. The program stores the data in an XML file.
Build a CMS, an exciting...
gwinru
webmaster
gwinru