EllisLab text mark
Advanced Search
1 of 2
1
   
Integrate Smarty Template Parsing into CodeIgniter
Posted: 25 October 2012 01:59 AM   [ Ignore ]   [ # 11 ]   [ Rating: 0 ]
Avatar
Joined: 2007-11-28
2435 posts

Jagar, perhaps you have a syntax / parse error in your template file. Check all your braces and such.

Also, if you’re trying to use the CI super object in your template, I believe you need to use lowercase “ci”. PHP variables are case-sensitive.

 
Posted: 25 October 2012 09:22 PM   [ Ignore ]   [ # 12 ]   [ Rating: 0 ]
Joined: 2012-10-24
2 posts

This is my first time i visit here. I found so many entertaining stuff in your post, nice to see that. especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the leisure here! Keep up

the good work.

 
Posted: 02 November 2012 10:44 PM   [ Ignore ]   [ # 13 ]   [ Rating: 0 ]
Avatar
Joined: 2009-04-22
154 posts

While I have the site set to the the following…

define('ENVIRONMENT''development'); 

I am getting so many notices for any variables that has no value.

A PHP Error was encountered

Severity
Notice

Message
Undefined indexvariable_name

Filename
compiled/05c167972ba6cf610a299ccf7eb20dfc787e78c8.file.....php

Line Number
45 

I understand that I can set the environment to production, but I would like to get rid of any errors and notices rather than hiding them and was wondering if you have workaround these

Thank you again


Thank you

 
Posted: 03 November 2012 07:44 AM   [ Ignore ]   [ # 14 ]   [ Rating: 0 ]
Avatar
Joined: 2007-11-28
2435 posts

Those errors come from your code, not the template library. Chances are you are trying to use a variable in your template that you have not added to your view data array.

 
Posted: 03 November 2012 11:05 PM   [ Ignore ]   [ # 15 ]   [ Rating: 0 ]
Avatar
Joined: 2009-04-22
154 posts

Thanks again Aken, I have defined the variables and the errors are not coming back

Regards

 
Posted: 11 December 2012 09:42 AM   [ Ignore ]   [ # 16 ]   [ Rating: 0 ]
Joined: 2011-12-22
1 posts

Hello Aken,

Thank you for creating this CI-Smarty integration.

I had to change MY_Loader.php because syntax errors were not showing.
The end of MY_Loader.php now contains:

try {
 $output 
$CI->smartytpl->fetch($template);
 
 
// Return the output if the return value is TRUE.
 
if ($return === true) return $output;
 
 
// Otherwise append to output just like a view.
 
$CI->output->append_output($output);
catch(Exception $e{
 show_error
($e->getMessage());

and now Smarty syntax errors are showing.

Is this the right way to do this? Can you change it in the git-repository, or should I do a pull-request?

Kind regards,
Hendrik

 
Posted: 11 December 2012 10:05 PM   [ Ignore ]   [ # 17 ]   [ Rating: 0 ]
Avatar
Joined: 2007-11-28
2435 posts

I’ll have to look into that. I never ran into Smarty syntax errors, so I’ll check into what kind of errors Smarty throws and how to integrate them into CI. Thanks for the heads up.

 
Posted: 12 March 2013 08:40 PM   [ Ignore ]   [ # 18 ]   [ Rating: 0 ]
Avatar
Joined: 2007-11-28
2435 posts

I’ve updated this script today; details are on the first page of this thread or on Github. smile

 
1 of 2
1