CodeIgniter Forums
Please give me the folder structure for Code Igniter -2.0.2 with smarty-3.0.8 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Please give me the folder structure for Code Igniter -2.0.2 with smarty-3.0.8 (/showthread.php?tid=44249)

Pages: 1 2


Please give me the folder structure for Code Igniter -2.0.2 with smarty-3.0.8 - El Forum - 08-09-2011

[eluser]SamJJS[/eluser]
I am new to CI. Please give me the folder structure and sample files for CI with smarty.
TIA - Sam



Please give me the folder structure for Code Igniter -2.0.2 with smarty-3.0.8 - El Forum - 08-09-2011

[eluser]praveens[/eluser]
Go through below url,

http://codeigniter.com/wiki/Better_Server_Setup_for_CI/

Cheers!


Please give me the folder structure for Code Igniter -2.0.2 with smarty-3.0.8 - El Forum - 08-09-2011

[eluser]SamJJS[/eluser]
Thanks Praveen. But i need CI-2.0.2 with smarty-3.0.8 folder structure


Please give me the folder structure for Code Igniter -2.0.2 with smarty-3.0.8 - El Forum - 08-09-2011

[eluser]echo sara[/eluser]
Hi

What is smarty used for if you don't mind me asking


Sara


Please give me the folder structure for Code Igniter -2.0.2 with smarty-3.0.8 - El Forum - 08-09-2011

[eluser]praveens[/eluser]
Go through below url

http://codesamplez.com/development/codeigniter-2-features


Please give me the folder structure for Code Igniter -2.0.2 with smarty-3.0.8 - El Forum - 08-09-2011

[eluser]echo sara[/eluser]
That link didnt explain what smarty is. it explained about codeigniter2.0 tho :-)


Please give me the folder structure for Code Igniter -2.0.2 with smarty-3.0.8 - El Forum - 08-09-2011

[eluser]praveens[/eluser]
Create one directory named ‘applications/init’.
create one file named ‘applications/init/init_mysmarty.php’
paste following in it:


Code:
if ( ! class_exists('MySmarty'))
{
require_once(APPPATH.'libraries/MySmarty'.EXT);
}

$obj =& get_instance();
$obj->mysmarty = new MySmarty();
$obj->ci_is_loaded[] = 'mysmarty';

?>




create one file named ‘applications/libraries/MySmarty.php’
paste following in the class :


Code:
class MySmarty extends CI_Smarty{

function __construct()
{
$this->compile_dir = APPPATH . "views/templates_c";
$this->template_dir = APPPATH . "views/ templates";
log_message('debug', "Smarty Class Initialized");
}
}
?>




paste “applications/libraries/libs” of smarty in libraries of application : refer to MySmarty.php class for the path. Create ‘templates_c’ and ‘templates’ in views directory


Try this controller:

Code:
function Blog()
{
parent::__construct();

$this->load->library('mysmarty');
}
function index()
{

$this->mysmarty->assign('title',"Welcome");
$this->mysmarty->assign('content',"Hello!");
$smarty_array =array('one','two','three','four');
$this->mysmarty->assign('forloop',$smarty_array);
$this->mysmarty->display("basic.html");
}
}
?>
basic.html
{$title}{$content}


{section name=i loop=$forloop}
{$forloop[i]}


{/section}


Cheers!!!!!!!!!


Please give me the folder structure for Code Igniter -2.0.2 with smarty-3.0.8 - El Forum - 08-09-2011

[eluser]echo sara[/eluser]
praveens good job with the example, but i'm confused on how all the files function with each other. Can you explain your example above pleasee. isnt smarty to make a cleaner viewer so there isnt alot of php cluttered in there?


Please give me the folder structure for Code Igniter -2.0.2 with smarty-3.0.8 - El Forum - 08-09-2011

[eluser]praveens[/eluser]
Sara

smarty is PHP Template Engine, for more info go through below url

www.smarty.net


Please give me the folder structure for Code Igniter -2.0.2 with smarty-3.0.8 - El Forum - 08-10-2011

[eluser]SamJJS[/eluser]
Great Praveen!... Smile It works Smile

Thanks