Welcome Guest, Not a member yet? Register   Sign In
Object of class stdClass could not be converted to string - error message
#1

[eluser]Unknown[/eluser]
Hello Everyone,



I am using grocerycrud. I am getting the following error message when I am using it with my template system:



A PHP Error was encountered

Severity: 4096

Message: Object of class stdClass could not be converted to string

Filename: desktop/mainpage.php

Line Number: 9



My controller:

Code:
function dashboard(){
$crud = new grocery_CRUD();
        
        $crud->set_table('clients');

        $data['clientgrid'] = $crud->render();  
        

        // Load the DashBoard
        
        $data['desktop'] = 'desktop/mainpage';
        $this->load->view('desktop/desktop', $data);}

Desktop.php view: (template setup)

Code:
<?php $this->load->view('desktop/header'); ?>


<?php $this->load->view($desktop); ?>


<?php $this->load->view('desktop/footer'); ?>
mainpage.php view (shows the actual page)

Code:
<div id="mydashboard">

  <div class="title">My Dashboard</div>

<div class="modulecontainerleft">
  <div class="moduletitle">Client List</div>
    <div class="grid">
    
    &lt;?php echo $clientgrid; ?&gt;
    </div>
</div>

  </div>
</div>

If I don't go through the template system, the grid load successfully.



Any suggestions or help will be greatly appreciated Smile
#2

[eluser]Massaki[/eluser]
The variable $clientgrid is an object.
If you want to show an attribute from the object, then
Code:
echo $clientgrid->name_of_the_attribute




Theme © iAndrew 2016 - Forum software by © MyBB