Created
December 5, 2017 10:00
-
-
Save kirasiris/d0f477373a8ef3bf3e27d5d0cfc2552b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!defined('BASEPATH')) | |
exit('No direct script access allowed'); | |
class Template | |
{ | |
var $ci; | |
function __construct() | |
{ | |
$this->ci = & get_instance(); | |
} | |
/* | |
* @name: load | |
* @desc: Loads the template and view specified/ Carga el template y el view especificado | |
* @param:loc: Location/ Locacion (admin or public) | |
* @param:tpl_name: Name of the template/ Nombre del template o layout | |
* @param:view: Name of the view to load/ Nombre del view a ver | |
* @param:data: Optional data array/ Array con valores opcionales | |
*/ | |
function load($loc, $tpl_name, $view, $data = null) | |
{ | |
if ($loc == 'admin' && $tpl_name == 'default') { | |
$tpl_name = 'admin'; | |
} | |
if ($loc == 'public' && $tpl_name == 'default') { | |
$tpl_name = 'public'; | |
} | |
$data['main'] = $loc . '/' . $view; | |
$this->ci->load->view('/templates/' . $tpl_name, $data); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment