codeigniter-template icon indicating copy to clipboard operation
codeigniter-template copied to clipboard

Problem when added single object to be passed to a view

Open danielgomezdidier opened this issue 14 years ago • 3 comments

When you try to pass a single object to a view you get the following error:

Object of class stdClass could not be converted to string

But as soon you wrap the object in to an array everything work fine.

The problem is present when you use $data[single_obj] = $this->a_model->get_single(); $this->template->build('some_view', $data); or

$this->template->set('single_obj', $this->a_model->get_single() ); $this->template->buil('some_view');

Thank you.

This library is great-

danielgomezdidier avatar Feb 20 '11 18:02 danielgomezdidier

Paste the full error.

philsturgeon avatar Sep 06 '11 16:09 philsturgeon

You probably need to disable the parsing library in the config. Change $config['parser_enabled'] = TRUE; to $config['parser_enabled'] = FALSE;.

PerceptionLLC avatar Sep 14 '11 17:09 PerceptionLLC

You probably need to disable the parsing library in the config. Change $config['parser_enabled'] = TRUE; to $config['parser_enabled'] = FALSE;.

Yes, this solves the problem. But how can we use both feature like: Send objects as param and user parser? I faced the same problem

curiousteam avatar Apr 17 '20 20:04 curiousteam