THINKCMF Introduction: THINKCMF is a Chinese content management framework based on PHP+MYSQL development. THINKCMF proposes a flexible application mechanism, which provides the basic management function, and the developer can extend it in the form of application according to its own requirements. Each application can complete its own task independently, and can also work together through the system invoke other applications. Under this operating mechanism, the users of developer field application need not care how to develop SNS application, but they can coordinate with the system itself, which greatly reduces the cost of development and communication.
In the past two months, has been painstaking learning thinkphp,thinkphp as a leader in the open source of domestic PHP, so that is not too much, after all, up to open source China to see the open source of PHP projects, not a few are not based on thinkphp. Said to be the best choice for SMEs is not too. And in all the thinkphp projects, I fancy THINKCMF this CMF framework, CMF for us, is a relatively new concept. Originally I was ready to look at the thinkphp official launch of the Onethink, but helpless this great God's work, I am very difficult to think of the purpose of small dishes. Can only wait to learn from the future when a good experience of those who worked for n years of the Philosopher's thoughts. Temporarily THINKCMF this framework is the most in line with my requirements, not only to connect the programmer's atmosphere, but also to connect the user's atmosphere, the relevant Third-party login is also integrated well, is indeed a lot of things ah. Here for a moment to share some of my notes on this CMF framework.
question one: THINKCMF's plug-in system is how to achieve.
Look at the picture:
In the root directory of the site there is a plugins directory, which has three plug-ins directory, respectively, Demo,jam,snow. These files are scanned by file scanning in the admin background and displayed in the extended management-> Hook , but note that the plugin's file specification is in the official document (Http://www.thinkcmf.com/document/article /id/372.html) written in detail, and the program also has a demo can be referred to, very convenient to use. When you click on the installation in the background, the relevant configuration files will be written to the database, including the hook introduction, and mount point (such as: footer).
Knowing this, when we visit the page each time the system will read the hook from the database and the function to be run to register, when running to this hook (such as Hook ("footer)" will trigger the function of these plug-ins.
Perhaps you will be very puzzled what is the hook, this is actually very simple, so do a small program metaphor:
<?php
function Do ($name) {
switch ($name) {case
' footer ': //Hook
func1 () {} //plugin a
Func2 () {}// plugin two
func3 () {}/ /plugin three break
;
Case ' footer_end ':
func1 () {}/ /plugin five
Func2 () {} //plugin six
func3 () {} //plugin seven break
;
}
Do ("footer")//Here is the execution of the footer hook, relative to the THINKCMF hooks (' hooks ')
question two: Why ordinary program's all Xxxxbehavior this writing, but THINKCMF can use XXXX directly
Because they changed the thinkphp frame Hook class source code, specifically see Simplewind\core\library\think\hook. The hook class in the classphp.