Create the world's simplest PHP development model _php Tutorial

Source: Internet
Author: User
PHP (as the current mainstream development language) as the "simplest" Web scripting language, in the domestic market is growing, PHP (as the mainstream development language now) ER more and more, but it feels like most people do not consider the pattern problem, what kind of design pattern is optimal, is the most suitable for their current work, after all, efficiency is the most important (with the time saved to play the game, how beautiful ah ...) )。 MVC should be the first choice, there are a lot of good MVC-based open source projects on www.sourceforge.net, and you can go through the research.
  
A few days ago to their company's website revision, mainly the article release system, the boss said backstage I want to design how to design, the only premise is fast. The framework of a simple release system was built. If simply from the article publishing system, basically can meet the "small and Medium" enterprise website article publishing system requirements, the total PHP in the background (as the current mainstream development language) code no more than 800 lines, and support arbitrary expansion and plugin functions.
  
No more nonsense, let's talk about my architecture, I hope you can help.
  
Note: Before you start, you need to download a template processing tool class: "Smarttemplate" and learn some simple uses of templates.
  
My test environment: Windows2k/apache (the most popular Web server platform for UNIX platforms) 2/php (as the current mainstream development language) 4.3.2/smarttemplate class library
  
Let's start with the distribution of the files for the entire Web site, which will be created and populated with the following directories and files in a later section
The root of my server's Web is "C:/apache (the most popular Web server platform for UNIX platforms) 2/htdocs/"
I set up a folder "Cmstest" as the home folder of my site below
The sub-file structure under folder "Cmstest" is:
  
/config.inc.php (as the current mainstream development language)
/list1.php (as the current mainstream development language)
/list2.php (as the current mainstream development language)
/new.php (as the current mainstream development language)
/add.php (as the current mainstream development language)
/view.php (as the current mainstream development language)
/page.js
/src/mysql (best combination with PHP) util.php (as the current mainstream development language)
/src/articleutil.php (as the current mainstream development language)
/src/coreutil.php (as the current mainstream development language)
/src/parsetpl.php (as the current mainstream development language)
/src/lib/smarttemplate/*.* This directory is used to store the Smarttemplate class library
/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 features of your company's website and the structure of the templates that have been designed, summarize the features to be implemented, and list the listings.
Analyze the function list and classify the functions. Each type of function has a common denominator and can be implemented in the same way.
Design the table structure of the database according to the function
Design a profile config.inc.php (as the current mainstream development language) to record some basic information about the site, including the database name ....
The interface functions for database queries are designed for each type of function, so that similar operations can be done as soon as the interface is called. This avoids a large number of code duplication operations that may occur later, and it achieves the purpose of code reuse.
Define your own wrapper function for the template tool, and later call it without the use of the template tool, only to their own packing function inside the plug number on it.
The basic function is OK, and the easy implementation of the page and the processing of the template are started.
  
Now we're going to start designing a simple system to see how I'm going to implement a "simplest article release system" step-by-stage, and of course just a simple project that I'm simulating, in which a project might be more complex than that.
  
   first, analysis of my case:
Oh, this customer project is very simple ah, happy ing ...
  
List1.php (as the current mainstream development language): There are three articles list and a button, "PHP (as the mainstream development language now) development article List" "PHP (as the mainstream development language now) Development Hot Article List" "ASP Development Latest article" "Add new article"
List2.php (as the current mainstream development language): There are 2 articles List "ASP Development article List" "ASP Development Hot Article List"
New.php (as the current mainstream development language): a page that adds a form to an article
Add.php (as the current mainstream development language): a page that processes new.php (as the current mainstream development language) of a form
View.php (as the current mainstream development language): Article View of the page
  
   second, analysis function
"PHP (as now mainstream development language) development article List" "ASP Development article List"-------in the order in which the articles are published, in reverse chronological display, 5 articles per page
"PHP (as the mainstream development language now) developing Hot articles List" ASP Development Hot Article List "-------by article click on the number of views sorted display article, showing 3 articles
"ASP Development Latest article" according to the article in the order of publication, reverse display, showing 3 articles
"Add new article"------The publishing feature of an article, including the article title/author/content

http://www.bkjia.com/PHPjc/509134.html www.bkjia.com true http://www.bkjia.com/PHPjc/509134.html techarticle PHP (as the current mainstream development language) as the "simplest" Web scripting language, in the domestic market is getting bigger, PHP (as the mainstream development language now) ER more and more, but the sense ...

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