Notice: Undefined index:
Posted: Mon Nov 26, 2007 12:05 am
Well
damn I don't understand what I do wrong.
I'm trying to get all the records from the database and display them in frontend.
My model look like this:
My view.html.php like this:
So and now my template:
My var_dump gives me the right array I'm looking for, but $this->items['author'] doesn't show me the author, rather than a notice message 
Notice: Undefined index: book_name in xxx\tmpl\default.php on line 11
var_dump looks like this
Any ideas?

I'm trying to get all the records from the database and display them in frontend.
My model look like this:
Code: Select all
class xxxModelxxx extends JModel {
var $_data;
function _buildQuery() {
$query = ' SELECT * FROM #__xxx';
return $query;
}
function getData() {
if (empty( $this->_data)){
$query = $this->_buildQuery();
$this->_data = $this->_getList( $query );
}
return $this->_data;
}
}
Code: Select all
class xxxViewxxx extends JView {
function display($tpl = null) {
$items =& $this->get( 'Data');
$this->assignRef( 'items', $items );
parent::display($tpl);
}
}
Code: Select all
<?php
defined('_JEXEC') or die('Restricted access'); ?>
<h1><?php var_dump($this->items); echo $this->items['author'];?></h1>
<h2>ala baala</h2>

Notice: Undefined index: book_name in xxx\tmpl\default.php on line 11
var_dump looks like this
Code: Select all
array(1) { [0]=> object(stdClass)#117 (20) { ["id"]=> string(1) "1" ["name"]=> string(4) "well" ["author"]=> string(11) "William well" } }