Development of large and medium-sized applications based on Typecho CMS framework

Source: Internet
Author: User
Development of large and medium-sized applications based on Typecho CMS framework

Medium and large applications are defined as: applications greater than or equal to 3 data tables! Sweat it!

Typecho was originally a blog system, its framework is different from the general meaning of the market MVC framework, the main code to self-created widgets for the base class, the whole is very concise.

Typecho basic features are as follows:

    1. Single entry
    2. Except DB configuration, other configurations are stored in DB
    3. The routing configuration is also stored in the DB
    4. Self-created widget layer, no traditional model layer
    5. Self-creating action layer, similar to the traditional controller layer
    6. Hook mechanism
    7. Pan plugin mechanism, plugin contains handler to register existing hooks, methods to extend existing widgets, register new front-end route to map new action, register back-end management interface
    8. UI Theme Support

Why to develop applications based on Typecho

I'm not Typecho official developer, and I'm not in the relevant background unit Segmentfault. Why use this niche framework?

In fact, you really don't need to use the typecho,php world to have too many frameworks, and you can choose a more advanced framework.

I do not know from when to start, I find myself a "small crowd" patients, do not like to take the normal road. Like Linux in the desktop area may be enough, but I like to use a smaller audience of FreeBSD.

It was just one of my attempts.

Practice

Principle: The service layer is added based on the MVC pattern.

    1. C-Layer

As we said earlier, Typecho has created the action concept, which is the basis of our C-tier, but the action is not clearly defined. So I'm going to define a controller base class.

    1. M layer

There is no model concept in Typecho, which calls SQL queries directly. So you also define the model base class.

    1. V-Layer

The view file is the content carrier of view, in order to reduce the learning cost, no longer introduce the template engine, that is, directly using PHP syntax and directly inductive C execution.

    1. Service Layer

In the complex application, the biggest problem of MVC is that reusable code is not refined enough, some people C layer is too fat, some people m layer is too fat. The introduction of the service business layer helps to refine and encapsulate the business layer, maximizing the reuse of code.

Demo Project: Typecho Alumni Alumni 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

==========
Not to be continued ...

The above describes the development of large and medium-sized applications based on the Typecho CMS framework, including PHP syntax, GitHub content, hope to be interested in PHP tutorial friends helpful.

  • 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.