Vheissu / Ci-Smarty

Smarty templating engine integration for Codeigniter 3.0+ with inbuilt theming and asset management.
http://ilikekillnerds.com
179 stars 43 forks source link

Use Ci-Smarty to extend from the controller #37

Closed piercemcgeough closed 10 years ago

piercemcgeough commented 10 years ago

I was looking on the smarty forum and found how to extend from the controller first before loading the view http://www.smarty.net/forums/viewtopic.php?p=71402&sid=a001c28775ec07f85bce6d3c91b90848

if(!empty($_REQUEST['lightbox']) { $smarty->display("extends:general/{$config->template->base1}|detail.tpl"); } else { $smarty->display("extends:general/{$config->template->base2}|detail.tpl"); }

Is it possible to do this with your Ci-Smarty

$this->parser->parse('login/login.tpl', $this->view_data); Im looking to choose which file to extend first then load the login.tpl

piercemcgeough commented 10 years ago

On further research it is the Extends Template Resources im looking for: http://www.smarty.net/docs/en/resources.extends.tpl

piercemcgeough commented 10 years ago

I got it working, sorry I must have done something silly.

$this->parser->parse('extends:layouts/base_1.tpl|file:folder/list.tpl', $this->view_data);

Vheissu commented 10 years ago

Glad you got it working Pierce. Let me know if you do come across anything else (no matter how small or silly).

haider-pw commented 10 years ago

http://stackoverflow.com/questions/25541382/smarty-templates-with-codeigniter-cant-load-template-when-too-many-directories

Solve this question, i am willing to put more bounty, just please solve it.