[eluser]jordanarseno[/eluser]
When data is passed from the controller to the view, it is automatically extracted from the array, into associated variables.
Is there any way to opt out of this functionality?
For those that have watched Jeffery Way's video tutorials, I work the same way he does; Application data, along with the actual title of the view to be loaded is first loaded into a template view. The template loads the header, the content, and then the footer.
I desire to work with the template engine using the parser library, but this has been made very difficult, because the second parameter in $this->parser->parse() is the data to be extracted in the view, but it's extracted by the time it gets to the template!
Does this make sense? Haha.
Example:
In my
Controller I have the following code...
Code:
...
$data['entities'] = $this->entity_model->get_all_entities_admin();
$data['main_content'] = 'admin_view';
$this->load->view("includes/logged_in_template", $data);
...
This loads the logged_in_template
View...which contains, among other things:
Code:
...
$this->load->view("includes/admin_header.php");
$this->parser->parse($main_content, $entities);
$this->load->view("includes/logged_in_footer.php");
...
Now in the actual admin_view.php
View I want to say:
Code:
...
{entities}
{live}
{datetime}
{/entities}
...
Where {live} and {datetime} are database columns that the get_all_entities_admin() function returned in the
Controller. I know these work, I had them going in a dumbed-down view earlier...without the header/content/footer template system.
The problem is in:
Code:
$this->parser->parse($main_content, $entities);
I'm getting:
A PHP Error was encountered
Severity: 4096
Message: Object of class stdClass could not be converted to string
Filename: libraries/Parser.php
Line Number: 63
Not sure how to actually get my $entities information into the admin_view.
I tried subbing in $data for the second parameter, but it does not recognize it as a variable.
THANKS!