- Learning tinkphp (hereinafter referred to as TP) has been almost two weeks, the progress is very slow, the main reason is that the front and back end of the content is not proficient, directly with the framework is not modified, while tinkphp more introductory content, practice scheduling time is not enough. When looking at the TP document found that there are many error content, but also there are many ambiguous content, I hope it can improve. However, this template is still very suitable for our web beginners, it can let you have a fundamental leap.
- Modular, Views view
- Before doing the Web page, just a simple document from beginning to end, TP took me to an object-oriented world! The idea of TP is to modularize the content, using the MVC pattern, similar to Java's encapsulation inheritance, and try not to duplicate the code snippet. However, due to the many aspects of web contact, there are HTML, JavaScript, JQ, CSS and so on, leading to real practice will be more troublesome, the various grammars will be more messy.
- After we set up the environment, the first thing to do is to imitate! When we get the complete website of others to imitate, we encounter the first problem, is how to split an interface accurately and properly, it is broken into some modules, this is the view of the content, very intuitive display, the main is: header, top menu, Main menu, slider, content, footer ... We can break up these fragments of an interface first and then continue to subdivide as needed. Each code fragment is a submodule that is put into the main module by using the include. For a website, there is bound to be roughly the same page, we only need to inherit extend a module in each interface. For those different chunks, just write in the interface code, the question is not the same HTML code in which specific location? TP There is a convenient way to solve this problem easily, the principle is very simple, like a picture frame, we can first put the picture frame, decorate very nice, inside photos, we can change at any time. The block tag provided by TP is doing so, in the module, we can add <block name= "text" in any suitable position ></block>,name is a name we give to this position, conveniently located in the real interface, such as: <block name= "Text" > News </block>.
- Controller controllers (to be continued)
- Model
tinkphp Framework Learning