Large and medium-sized applications developed based on TypechoCMS framework

Source: Internet
Author: User
: This article mainly introduces the development of large and medium-sized applications based on the TypechoCMS framework. if you are interested in the PHP Tutorial, refer to it. Develop large and medium-sized applications based on Typecho CMS Framework

Large and medium-sized applications are defined as: applications with more than or equal to three data tables! Sweat!

Typecho was originally a blog system. its framework system is different from the common MVC framework on the market. The main code is based on its own widgets, which is very simple as a whole.

The basic features of Typecho are as follows:

  1. Single Portal
  2. Except Db configuration, other configurations are stored in DB
  3. Route configuration is also stored in DB
  4. Create a Widget layer without a traditional Model layer
  5. Create an Action layer, similar to the traditional Controller layer
  6. Hook mechanism
  7. Generic Plugin mechanism. Plugin includes registering Handler of an existing Hook, extending the methods of existing widgets, registering a new front-end Route to map new actions, and registering the backend management interface.
  8. Supports UI themes

Why develop applications based on Typecho?

I am not an official developer of Typecho, nor am I working in segmentfault, a background organization. why do I use this niche framework?

In fact, you do not need to use Typecho. there are too many frameworks in the PHP world, so you can choose a more advanced framework.

I don't know when I began to find myself a "niche" patient, and I don't like to take the ordinary path. Just like Linux may already be small enough in the desktop field, but I like FreeBSD with a smaller number.

This is just one of my attempts.

Practice

Principle: add a Service layer based on the MVC mode.

  1. Layer C

As we have mentioned earlier, the concept of Action is created in Typecho, which is the basis of the C layer, but the Action is not clearly defined. So I will define a Controller base class.

  1. M layer

Typecho does not have the concept of Model. it directly calls SQL queries. Therefore, you must also define the Model base class.

  1. V layer

View files are the content carrier of views. to reduce learning costs, you can directly use them without introducing the template engine.PHP syntaxAnd directly attract execution in C.

  1. Service Layer

In complex applications, the biggest problem with MVC is that reusable code is not refined enough. some people are too fat at layer C and some are too fat at layer M. Introducing the Service layer helps to refine and encapsulate the Service layer and improve code reuse as much as possible.

Demo Project: Typecho Alumni plugin recording plug-in project

Code address: https ://Github. Com/web3d/plugins/tree/master/Alumni

Project code structure:

/Plugins/Alumni/Base/Action. php | Model. php | Service. php | Helper. php
/Plugins/Alumni/Model/
/Plugins/Alumni/Service/
/Plugins/Alumni/Action/
/Plugins/Alumni/views/default/

/Plugins/Alumni/Plugin. php
/Plugins/Alumni/panel. php

============
To be continued...

The above introduces the development of large and medium-sized applications based on the Typecho CMS Framework, including the PHP syntax and github content, and hopes to help those who are interested in the PHP Tutorial.

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.