Welcome Guest, Not a member yet? Register   Sign In
how to simultate a template with codeigniter

sorry my english is very bad because i am frenchspoken but this framework interest me very much i understood architecture but i want to load all my views in one file like a template or a pseudo-frame i look help please !


class Your_Controller extends Controller
    function index()
Template View:

Header view:

  <title>My embedded view test</title>
  <h1>This is my header heading</h1>
Body view:

<p>All the main content stuff would go in this view</p>
Footer view:

<p>Maybe some footer stuff down here, like copyright and what not</p>

Hope that helps... there is a good tutorial around here somewhere if what I post is not enough. Just do a search for "views within views".

If you want to use PHP exclusively without using a template system language, you might want to take a look at Coolfactor's View library. It's a good solution for mangaging master views (effectively, PHP-based templates) and view fragments (partials or blocks), and embedding CSS, JS and meta data code.

There are forum treads and wiki articles about using full template parsing engines with CodeIgniter. You might try doing some forum searches for Smarty, bTemplate, YATS, TemplateFlexy, Tiny-But-Strong, etc. CI also plays well with some Javascript libraries with their own layout features such as YUI (Yahoo User Interface components), EXT (Jack Slocum's extensions to YUI (with adapter support for AJAX libraries), MooTools, JQuery (user contributed plugins), etc. CI comes with a light Template Parser library which could be used for smaller projects.

You will achieve faster application performance by sticking with PHP as a template language. The decrease in application performance when using a full template engine will vary depending on the complexity of the engine and caching support. The Javascript layout libraries result in larger drains in application performance initially but this can be improved significantly with PHP caching techniques and the use of selectors.

Theme © iAndrew 2016 - Forum software by © MyBB