官术网_书友最值得收藏!

  • CodeIgniter 1.7
  • David Upton Jose Argudo Blanco
  • 297字
  • 2021-04-01 13:45:30

Summary

The MVC pattern is a widely used and is a very effective way of organizing a complex website. CI uses it to help you sort your own code, but it is also fairly flexible about how it does so.

The crucial thing is to understand what the different type of files are, and how they relate to each other. Then, you can decide whether to write your code in library or model files, or as helpers or plugins.

We've looked at the CI file structure, and seen how you can, if you want, inspect all the CI code, but (thankfully!) you don't have to. We did tinker with one of the original files—the config file, which holds critical site information in one place to make it easy for us to upgrade or change later.

We've seen the basic object structure of a controller, and used a simple constructor to get some data from our config file and put it into a class property. We've dynamically passed information from a new controller we wrote, to a new view. So far, the main thing CI has done for us is to encourage us to use a basic structure as we start to define our site. As we go on, it will become clear just how important that structure is.

Also, we looked at the way in which CI's components pass data and control between themselves. It's useful to understand this when you start to write your code.

Lastly, we looked at CI's own URL helper as a good example of a chunk of code, and we wrote our own rudimentary menu library class. Now continue to Chapter 4, where we will see how CodeIgniter will help us improve the way we work with databases, don't wait!

主站蜘蛛池模板: 梅河口市| 贵南县| 恩施市| 晋中市| 白城市| 石柱| 大丰市| 内丘县| 镇安县| 将乐县| 桑日县| 临漳县| 临朐县| 九台市| 南丹县| 绥阳县| 隆昌县| 永宁县| 遂昌县| 平顺县| 北安市| 乌兰县| 绿春县| 阜城县| 扶风县| 监利县| 德阳市| 舒兰市| 湾仔区| 政和县| 武汉市| 溧水县| 前郭尔| 策勒县| 大城县| 邛崃市| 宣威市| 江门市| 内丘县| 盈江县| 永修县|