Just read a few recommendations of the framework of the post, quite a lot of recommended CodeIgniter, please forgive me, the framework is not flattering AH personal opinion, for reference only

Source: Internet
Author: User
Tags codeigniter
Just read a few recommendations of the framework of the post, quite a lot of recommended CodeIgniter, please forgive me, the framework is not flattering ah ~ personal opinion, for reference only.
First I used CodeIgniter, just started to learn the framework when used for a while, and then the company with Thinkphp, it was no longer used, after 2, there will be some contrast. First of all, the 2 frame folder capacity is relatively large, not lightweight and so on, I do not look good.
Today Nathan CodeIgniter Framework
Example of an official website controller invocation template
 
  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;? >






Feeling this mode is not good, is this the legendary controller template separation? This mode can only be used to trick the phper of the beginning, regardless of the call smarty or the like to refute me, just say his own characteristics, and what framework can be combined with smarty to use.

The above code can be implemented with a PHP function, please refer to the use of the extract function.

Many use CodeIgniter Phper estimate is directed at the so-called graceful to go, can use coherent writing,

In essence, there is no significant effect on the template (view),

Just calculate all the variables first, change the name, and then, when needed, fill in the new name to the desired place.

Then, when the individual is wandering around a foreign site, a template is found, which has a great similarity to the CodeIgniter model. The template name is unknown. You can look at it and you can get a general idea of the CodeIgniter principle.

It's the core template code I write about
 template.php
/**
* Copyright (c) 2003 Brian E. Lozier ([email protected])
*
* Permission is hereby granted, free of charge, to all 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 does so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall is 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
*/
  • Related Article

    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.