I have just read a few posts on the recommendation framework. I recommend codeigniter a lot. please forgive me for my respect. The framework is not flattering. my personal opinions are for reference only.

Source: Internet
Author: User
Tags codeigniter
I have just read a few posts on the recommendation framework, and I recommend codeigniter a lot. I'm sorry to say that the framework is not flattering ~ Personal opinions are for reference only. First, I used codeigniter. I used codeigniter for a while when I first started learning the framework. then, my company used thinkphp and I didn't use it anymore. After I used two, there would be some contrast. First of all, I have read several posts about the recommendation framework. codeigniter is recommended by many people. I'm sorry to say that the framework is not flattering ~ Personal opinions are for reference only.
First, I used codeigniter. I used codeigniter for a while when I first started learning the framework. then, my company used thinkphp and I didn't use it anymore. After I used two, there would be some contrast. First of all, the two frameworks have a large folder capacity, and I am not very optimistic about them because they are not lightweight.
Today I will talk about the codeigniter framework
An example of the controller call template on the official website
 class Blog extends CI_Controller {

 function index()
 {
  $data['title'] = "My Real Title";
  $data['heading'] = "My Real Heading";
  
  $this->load->view('blogview', $data);
 }
}
?> 



<?php echo $title;?>


 



I think this mode is very bad. Is this the so-called controller template separation? In this mode, you can only fool the PHPer that you just got started with. no matter whether you call smarty or the like to refute me, you just need to talk about its own features and use any framework in combination with smarty.

The above code can be implemented using a PHP function. please refer to the usage of the extract function.

Many PHPer estimates using codeigniter aim at the so-called elegant writing, and can be written in a coherent way->

The essence is that it does not have much effect on the template (view,

Just calculate all the variables, change the name, and enter the new name as needed.

Then, when I am hanging out on a foreign website, I find a template that is very similar to the codeigniter model. If the template name is unknown, call it template. You can have a general understanding of the codeigniter principle.

Let me write down its core template code.
 //template.php
/**
 * Copyright (c) 2003 Brian E. Lozier (brian@massassi.net)
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to
 * deal in the Software without restriction, including without limitation the
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 * sell copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */

class Template {
var $vars; /// Holds all the template variables
var $path; /// Path to the templates

/**
 * Constructor
 *
 * @param string $path the path to the templates
 *
 * @return void
 */

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.