⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

always show unknown text("array array")



near
  • profile picture
  • Member

Posted 15 December 2012 - 06:45 AM

can you help me :(

i make a standart coding with grocerycrud for my project, but when i running in browser i get this unknown text "array array".

it's a screenshoot
[attachment=397:arra.png]

victor
  • profile picture
  • Member

Posted 15 December 2012 - 07:05 AM

Hi Near and welcom to the forum. Can you show your code?

near
  • profile picture
  • Member

Posted 15 December 2012 - 07:27 AM

i'am newbie in Codeigniter,it's my controler(admin.php) :


<?php
class Admin extends CI_Controller{
function __construct()
{
parent::__construct();

$this->load->database();
$this->load->library('grocery_CRUD');
}

function index()
{
$data['output'] = (object)array('output' => '' , 'js_files' => array() , 'css_files' => array());
$data['isi']='admin/dashboard';
$this->load->view('admin/template',$data);
}
function user()
{
try{
$crud = new grocery_CRUD();
$crud->set_table('user');
$crud->set_subject('User');
$crud->required_fields('username');
$crud->change_field_type('password', 'password');
$data['output']=$crud->render();
$data['isi']='admin/crud';
$this->load->view('admin/template',$data);
}catch(Exception $e){
show_error($e->getMessage().' --- '.$e->getTraceAsString());
}
}
}
?>


i call function user() and
it's my view(template.php) :


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<?php
foreach($output->css_files as $file): ?>
<link type="text/css" rel="stylesheet" href="<?php echo $file; ?>" />
<?php endforeach; ?>
<?php foreach($output->js_files as $file): ?>
<script src="<?php echo $file; ?>"></script>
<?php endforeach; ?>

<link href="<?php echo base_url(); ?>/public/css/adminstyle.css" type="text/css" rel="stylesheet" />
<link href="<?php echo base_url(); ?>/public/css/menu.css" type="text/css" rel="stylesheet" />
<title>Control Panel Waka Wiki</title>
</head>
<body>
<?php echo $this->load->view('admin/header');?>
<div id="tengah">
<?php echo $this->load->view($isi);?>
</div>

<div id="footer">
asdfasdf
</div>
</body>
</html>


in line <?php echo $this->load->view($isi);?> it's load view "crud.php"


<div id="crud">
<?php
foreach($output as $out): ?>
<? echo $out; ?>
<?php endforeach; ?>
</div>


please help me :(
(sorry for my bad english)

victor
  • profile picture
  • Member

Posted 15 December 2012 - 09:49 AM

Your error is here:

<div id="crud">
<?php
foreach($output as $out): ?>
<? echo $out; ?>
<?php endforeach; ?>
</div>

the $out is array.
$out[1] = "Your grid"
$out[2] = array('css_files'=>array(.....))
$out[3] = array('js_files'=>array(.....))

----------------------------------------
try this:

<div id="crud">
<?php
echo $output->output ?>
</div>

near
  • profile picture
  • Member

Posted 15 December 2012 - 10:49 AM

it's work..

very very help me, thank's my friends