Welcome Guest, Not a member yet? Register   Sign In
Sub-obects break Template Parser data
#1

[eluser]Unknown[/eluser]
I'm not sure if this is a bug or new feature request, but I had a problem with putting an object into the Template data - the Parser library tries to convert it to a string and errors at line 63. It's fine with an array, but I wanted to put a DB object in there in amongst other 'flat' data, and it's annoying to have to convert it to an array, or hide it in some other way.

eg.
Code:
$oTVars->oTest = $this->testmodel->get_object($iTestID);
$oTVars->sName = 'some other flat content';
$this->parser->parse('page-home_test-view', $oTVars);
So I've changed line 57 of system/libraries/Parser.php thus:

Code:
if (is_array($val) || is_object($val))
and it now works as expected.

Is this something that might be considered for later releases - or does it introduce problems? Or is there another way round it?




Theme © iAndrew 2016 - Forum software by © MyBB