Home php教程 php手册 Yaapi和PHP构建一个简单的内容管理系统

Yaapi和PHP构建一个简单的内容管理系统

Jun 13, 2016 am 10:26 AM
php web Who are you content and Construct of Simple management system

如果你是一个正在构建具有丰富内容的Web网站的开发人员,你就可能需要考虑下面这些解决方案,其中包括(a)用于内容的数据库,(b)将GUI与内容分离的模板系统,(c)用来维护数据库里数据的用户友好界面,以及(d)对所生成页面的最终外观的控制。
能够提供上述所有内容的一个非常有趣的解决方案就是Yaapi,它是“你的文章应用程序编程接口(Your Article Application Programming Interface)”的开头字母缩写。它是一个PHP类,提供了内置的方法来访问保存在数据库里的内容。管理模块装备有协助管理数据的类,而这个API本身都足够强大,可能够处理内容管理系统(CMS)所要求的大多数常见任务。
安装要安装和使用Yaapi,你需要一个支持PHP的Web服务器,例如Apache,当然还有PHP,以及MySQL数据库服务器。你可以下载一份Yaapi,将它解压到服务器根目录下的某个位置里。
你还需要创建一个MySQL数据库,以容纳Yaapi的数据结构。使用源档案里的yaapi.sql文件创建这个数据库,然后打开类构造函数(article.class.php文件)里的Yaapi配置,使用用于该数据库的名字和访问参数更新它。
添加内容要向数据库里添加内容,你就必须使用http://your-server/yaapi-root/admin/上的Yaapi管理模块(用安装有Yaapi的服务器的名称来替换“your-server”,并用Yaapi解压后的目录来替换“yaapi-root”)。你要使用这个管理模块来创建(和删除)内容类别,然后把文章放到这些类别里。下面就是你会在这一过程中碰到的字段的简表:
类别(Category):文章的类别 章节ID(Section ID):如果你的文章有两个层次,就要使用这个参数来定义第二个层次。 标题(Title):文章的标题 作者(Author):文章的作者 电子邮件(E-mail):文章作者的电子邮件地址 许可(Approved):用来表示文章是否已经“得到许可”可以进行显示的标志 图像(Image):与文章相关的可选图像URL 内容(Content):文章的内容 关于上面最后一个项目的一点小小注释:通过在文章文本里插入分隔符,Yaapi能够把你的大段文章分在若干个小的页面里进行显示。见下面的例子:


Introduction of article here
#intro#Page 1 content here #page#Page 2 content here #page#Page 3 content here #page#and so on...
别忘了在输入文章之后确认一下,因为只有经过确认的文章才能够用API检索得到。
Statement of this Website
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

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

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

To work on file upload we are going to use the form helper. Here, is an example for file upload.

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

CakePHP Creating Validators CakePHP Creating Validators Sep 10, 2024 pm 05:26 PM

Validator can be created by adding the following two lines in the controller.

CakePHP Logging CakePHP Logging Sep 10, 2024 pm 05:26 PM

Logging in CakePHP is a very easy task. You just have to use one function. You can log errors, exceptions, user activities, action taken by users, for any background process like cronjob. Logging data in CakePHP is easy. The log() function is provide

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

CakePHP Quick Guide CakePHP Quick Guide Sep 10, 2024 pm 05:27 PM

CakePHP is an open source MVC framework. It makes developing, deploying and maintaining applications much easier. CakePHP has a number of libraries to reduce the overload of most common tasks.

See all articles