search
HomeBackend DevelopmentPHP TutorialDevelop large and medium-sized applications based on Typecho CMS framework

Develop large and medium-sized applications based on the Typecho CMS framework

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

Typecho was originally a blog system. Its framework system is different from the general MVC framework on the market. The main code uses the self-created Widget as the base class, and the whole is very simple.

The basic features of Typecho are as follows:

  1. Single entrance
  2. Except for Db configuration, other configurations are stored in DB
  3. Routing configuration is also stored in DB
  4. Self-created Widget layer, no traditional Model layer
  5. Create your own Action layer, similar to the traditional Controller layer
  6. Hook mechanism
  7. Pan-Plugin mechanism. Plugin includes methods to register existing Hook Handlers, extend existing Widgets, and register new front-end Routes to map new Actions. Register backend management interface
  8. Support UI themes

Why should we develop applications based on Typecho

I am not an official developer of Typecho, nor do I work in the related background unit segmentfault. Company, why should I use this niche framework?

In fact, you really don’t need to use Typecho. There are too many frameworks in the PHP world, and you can choose a more advanced framework.

I don’t know when I started to realize that I am a “niche” patient and don’t like to follow the ordinary path. Just like Linux may be niche enough in the desktop field, but I like to use FreeBSD, which is even more niche.

This is just my attempt.

Practice

Principle: Based on the MVC model, add a Service layer.

  1. C layer

As we said before, Typecho created its own Action concept, which is the basis of our C layer, but Action has no clear definition. So I will define a Controller base class.

  1. M layer

There is no concept of Model in Typecho, all SQL queries are called directly. So the Model base class must also be defined.

  1. V layer

View file is the content carrier of View. In order to reduce the learning cost, the template engine is no longer introduced, that is, the PHP syntax is directly used and directly imported into C for execution.

  1. Service layer

In complex applications, the biggest problem of MVC is that the reusable code is not refined enough. Some people have the C layer too fat, and some people have the M layer too fat. The introduction of the Service business layer helps to refine and encapsulate the business layer and maximize the reuse of code.

Demo project: Typecho 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

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

The above introduces the development of large and medium-sized applications based on the Typecho CMS framework, including PHP syntax and github content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
php怎么把负数转为正整数php怎么把负数转为正整数Apr 19, 2022 pm 08:59 PM

php把负数转为正整数的方法:1、使用abs()函数将负数转为正数,使用intval()函数对正数取整,转为正整数,语法“intval(abs($number))”;2、利用“~”位运算符将负数取反加一,语法“~$number + 1”。

php怎么判断有没有小数点php怎么判断有没有小数点Apr 20, 2022 pm 08:12 PM

php判断有没有小数点的方法:1、使用“strpos(数字字符串,'.')”语法,如果返回小数点在字符串中第一次出现的位置,则有小数点;2、使用“strrpos(数字字符串,'.')”语句,如果返回小数点在字符串中最后一次出现的位置,则有。

php怎么设置implode没有分隔符php怎么设置implode没有分隔符Apr 18, 2022 pm 05:39 PM

在PHP中,可以利用implode()函数的第一个参数来设置没有分隔符,该函数的第一个参数用于规定数组元素之间放置的内容,默认是空字符串,也可将第一个参数设置为空,语法为“implode(数组)”或者“implode("",数组)”。

如何利用PHP和Typecho构建社交媒体网站如何利用PHP和Typecho构建社交媒体网站Jul 22, 2023 am 11:40 AM

如何利用PHP和Typecho构建社交媒体网站随着社交媒体的兴起,越来越多的人希望拥有一个属于自己的社交媒体网站。而搭建一个社交媒体网站的其中一种方式是使用PHP和Typecho这两个开源工具。PHP是一种被广泛应用于Web开发的脚本语言,而Typecho是一个小巧、易用、安全的博客系统,不仅功能强大,而且可以方便的进行二次开发。下面我将介绍如何使用PHP和

如何使用PHP和Typecho打造多语言支持的网站如何使用PHP和Typecho打造多语言支持的网站Jul 21, 2023 pm 11:21 PM

如何使用PHP和Typecho打造多语言支持的网站导语:随着全球化的发展,构建一个多语言支持的网站逐渐成为企业和个人所追求的目标。而PHP作为一种流行的编程语言,结合Typecho这一优秀的PHP开源博客程序,可以轻松实现多语言网站的搭建。本文将介绍如何使用PHP和Typecho来打造一个多语言支持的网站,并提供相关的代码示例。一、安装和配置Typecho首

php怎么去除首位数字php怎么去除首位数字Apr 20, 2022 pm 03:23 PM

去除方法:1、使用substr_replace()函数将首位数字替换为空字符串即可,语法“substr_replace($num,"",0,1)”;2、用substr截取从第二位数字开始的全部字符即可,语法“substr($num,1)”。

php有操作时间的方法吗php有操作时间的方法吗Apr 20, 2022 pm 04:24 PM

php有操作时间的方法。php中提供了丰富的日期时间处理方法:1、date(),格式化本地日期和时间;2、mktime(),返回日期的时间戳;3、idate(),格式化本地时间为整数;4、strtotime(),将时间字符串转为时间戳等等。

php怎么去掉数组键值php怎么去掉数组键值Apr 20, 2022 pm 05:12 PM

php去掉数组键值的方法:1、使用“array_keys($array)”语句,可去掉全部键值,返回包含全部键名的数组;2、使用“array_splice($array,$start,$length)”语句,可去掉指定位置的一个或多个键值。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.