Giter VIP home page Giter VIP logo

kohana_smarty3's Introduction

Smarty3 Module for Kohana

This is a module for the Kohana PHP framework that integrates the Smarty Template Engine.

Version 2 working version 2.0.0

This version is compatible with Kohana 3.3. See the live documentation for other versions.

Documentation and support for this module can be found on Github.

Quick Start

  • Download and unpack the module
  • Put the smarty3 module in your modules directory
  • Enable the smarty3 module in your bootstrap file
  • To use Smarty for a view you need to create a Smarty template template_name.tpl in your application's views directory. Then when you do $view = View::factory('template_name.tpl') you can use the $view object just as you would with a regular PHP view.
  • That's all there is to it! There's only one hitch, you can't use $view = new View('template_name.tpl') or change the template of an existing PHP view object to a Smarty template with $view->set_filename().
  • If your controller extends the Controller_Template class, you can use a Smarty template for your page layout too - just set public $template = 'layout_template_name.tpl'; in your controller class.

Upgrading from earlier Version 2 releases

  • Download and unpack the module
  • Replace the existing smarty3 module with the new version
  • Delete compiled templates (in APPPATH/cache/smarty_compiled by default)

Upgrading from older versions

Upgrading from older versions should work as above.

How does this magic work?

The Smarty module creates a View class that extends Kohana_View to intercept the View::factory() method and return an instance of either the unmodified Kohana_View for a PHP template or an instance of Smarty_View if the view file has the .tpl extension. Smarty_View implements the methods of Kohana_View to act on a Smarty object. If you are converting existing code, or just prefer to use the Smarty object directly, you can access it with $view->smarty(), but note that not all of the available methods have been tested and may produce unpredicatable effects.

More information

Documentation and support for this module can be found on Github. Support for Smarty and its standard plugins is of course on the Smarty site.

Copyright

Licence

This distribution of the Smarty3 Module for Kohana is released under the Kohana License

The distribution of Smarty included in this package is released under the GNU Lesser General Public License (LGPL) - see the Smarty documentation for more details.

kohana_smarty3's People

Contributors

mranchovy avatar nikulinsasa avatar samuelecarpene avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.