Create the world's simplest PHP development model

Source: Internet
Author: User
Php (as the mainstream development language) as the "simplest" Web scripting language, is growing in the domestic market, php (as the mainstream development language) er more and more, however, it seems that most people have not considered the pattern problem. what kind of design pattern is the best, which is the most suitable for their current work, SyntaxHighlighter. all ();
Php (as the mainstream development language) as the "simplest" Web scripting language, is growing in the domestic market, php (as the mainstream development language) er more and more, however, it seems that most people have not considered the pattern problem. what kind of design pattern is the best and the most suitable for their current work? after all, efficiency is the most important (playing games with the time you have saved, pretty beautiful ...). MVC should be the first choice. There are many excellent MVC-based open source projects on www.sourceforge.net, so you can skip the research.
  
I revised my company's website a few days ago, mainly through the article publishing system. The boss said that I would like to design the website in the background, but the only premise is fast. So I built a simple release system framework. From the perspective of the article publishing system, it can basically meet the requirements of the article publishing system for "small and medium-sized" enterprise websites, and the total php in the background (as the mainstream development language) the code contains no more than 800 lines and supports arbitrary expansion and plugin functions.
  
I will not talk about it anymore. let's talk about my architecture and hope it will help you.
  
Note: Before starting, you need to download a template processing tool class: "smarttemplate" and learn about the simple use of some templates.
  
My test environment: windows2k/apache (the most popular WEB server platform on the Unix platform) 2/php (as the mainstream development language) 4.3.2/smarttemplate class library
  
First, let's talk about the distribution of files on the entire web site. in the subsequent sections, we will create and fill in the following directories and files.
The web root directory of my server is "C:/apache (the most popular WEB server platform on Unix) 2/htdocs /"
I created a folder "cmstest" below as the main folder of my website
The sub-file structure under the "cmstest" folder is:
  
/Config. inc. php (as the mainstream development language)
/List1.php (as the mainstream development language)
/List2.php (as the mainstream development language)
/New. php (as the mainstream development language)
/Add. php (as the mainstream development language)
/View. php (as the mainstream development language)
/Page. js
/Src/MySQL (the best combination with PHP) Util. php (as the mainstream development language)
/Src/ArticleUtil. php (as the mainstream development language)
/Src/CoreUtil. php (as the mainstream development language)
/Src/ParseTpl. php (as the mainstream development language)
/Src/lib/smarttemplate/*. * This directory is used to store
/Smart/template/list1.htm
/Smart/template/list2.htm
/Smart/template/new.htm
/Smart/template/add.htm
/Smart/template/view.htm
/Smart/cache/
/Smart/temp/
  
   Design steps:
Consider the characteristics of your company's website and the structure of the designed template, summarize the functions to be implemented, and list them.
Analyze the function list and classify the functions. Each type of function has something in common and can be implemented in the same way.
Design the table structure of the database based on the function
Design a configuration file config. inc. php (as the mainstream development language) to record some basic information about the website, including the database name ........
Design database query interface functions for each type of function, so that similar operations can be called in the future. This avoids a large number of code repetitive operations in the future, and achieves the purpose of code reuse.
Define your own packaging function for the template tool. you don't need to worry about the use of the template tool when calling it later. you only need to add a number to your own packaging function.
The basic function is okay, so you can easily implement the page and process the template.
  
Now let's start designing a simple system to see how I can implement a "simplest article publishing system" step by step. of course, it's just a simple project I have simulated, in reality, a project may be much more complicated than this.
  
   I. analyze my cases:
Haha, this customer project is so simple, happy ing ..........
  
List1.php (as the mainstream development language): There are three articles and a button, "php (as the mainstream development language) development article list "" php (as the current mainstream development language) development hotspot article list "" asp development latest article "" add new article"
List2.php (as the mainstream development language): There are two articles in the list: "asp development article list" and "asp development hotspot article list"
New. php (as the mainstream development language): a page for adding a document form
Add. php (as the mainstream development language): process the page of the form in new. php (as the mainstream development language)
View. php (as the mainstream development language): page viewed by the article
  
   II. analysis functions
"Php (as the mainstream development language) development article list" asp development article list "------- displays the article in reverse order according to the publishing order, and 5 articles on each page
"Php (as the mainstream development language) development hotspot article list" asp development hotspot article list "------- display the article by the number of clicks of the article to display three articles
"Asp development latest articles" are displayed in reverse order according to the publishing order of the articles. three articles are displayed.
"Add new article" ------ the publishing function of an article, including the article title/author/content

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.