Using PHP to build your own Web content Management System cms_php Tutorial

Source: Internet
Author: User
Fire Station Academy documentationIf you have the time and technology to write your own content management system, then this may be the best option. We are now stepping up to teach you to build your own PHP Content Management system (CMS).

Peter Zeidman translation: Mint Li

If you want to build a website, then you might want a content management system (CMS)-a tool that makes your website articles visible at a glance. I rarely mention this in previous articles, but many commercial sites have only one choice: to write a system that suits you.

Why is it? As if the system you wrote lacked stability. On the contrary, hundreds of people write systems that run successfully on thousands of websites. But once there is a problem, you will find it very difficult to figure out where the problem is. If you want to customize or modify your own, you will face huge code and obscure documents.

Write your own CMS, on the other hand, will find the most suitable for their own needs of the solution, the most suitable for your users ' needs, to find out the problems of their development team. This is the best choice if you have the time and energy to write it yourself. That's why I mentioned it again and again.

We will use PHP to write because it is a very good web-based development language. MySQL will also be used as a background database, while the system will also support other databases, such as PostgreSQL and SQL Server.

So what is our system going to do? First and foremost, it allows the content of a large number of websites to be conveniently collected into their own databases. Of course, a successful site also includes many other important features, such as user authentication and file management.

Plan your CMS

First, we need to plan what functions our system needs to achieve. In a future article, I'll use an example to illustrate some of the main tools and components that make your system more complete.

The first step you need to write a basic requirement for your CMS, it is clear that this needs to come according to your needs.

Content management: The most important function of the system is to keep content such as documents and news in the database, and then display requests from users. Easy to edit, add delete modified interface.
User authentication: We may want to restrict access to certain sites, and obviously need an administrator to be able to add edits and modify content anywhere. You may want to allow a subset of people or departments to access your site.
Page Styles/Templates: The whole system should give people a unified style, which requires separating the business process from the interface, which requires separating the content from the display style.
Object Oriented OOP

PHP supports OOP. When we organize our system, we will find that a lot of code will be used repeatedly, such as connection database, user authentication and so on. Keep the code neat and beautiful, we put them all in the classes file called. We instantiate the object when needed. So the idea of class can be used on many occasions.

For example, we can create a connection database class, when we need to query the database when we put this class, if you are not very clear about this concept does not matter, when we start our code is you will be more and more understanding. This approach can divide very complex systems into small and simple modules, and make things simple, easy to manage, modify and find errors.

Now let's consider how to organize the system effectively. Of course this is all about your own needs, the following picture is a basic idea:



We have four main modules that are used extensively in the system. Is the database access, users upload files, the template read and write, the user's login and logoff. All classes are inherited from the SystemObject class.

Although they are all placed in the SystemObject class, the four classes are independent of each other. This hierarchical approach allows us to change all four subclasses by modifying the SystemObject parent class. In addition, this concept will be clearer when we start specific examples. In the chart above is a basic management system, each function requires one or more pages to implement.

http://www.bkjia.com/PHPjc/364240.html www.bkjia.com true http://www.bkjia.com/PHPjc/364240.html techarticle Fire Station Academy documentation If you have the time and technology to write your own content management system, then this may be the best option. We are now stepping up to teach you to build your own PHP Content management system ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.