Thanks for the reply mikesta707. Here is the full index for one of my catalog items, the controller, and the helper. Let me know if you need any more information.
view -> index:
<?php
echo $this->Html->image('../img/nintendo_logo.jpg', array('alt' => 'nintendo'));
?>
<br /><br />
<?php
if($this->Session->read('Auth.User.admin')){
echo $html->link($html->image("../img/fam/add.png", array('alt' => 'add', 'style' => 'padding-top:3px')), array('action' => 'add'), array('escape' => false));
};
echo " ";
?>
<?php
if($this->Session->read('Auth.User.admin')){
echo $html->link('Add Game',array('controller' => 'nintendos', 'action' => 'add'));
}
?>
<table>
<tr>
<th><?php echo $this->Paginator->sort('Name', 'Nintendo.name');?></th>
<th><div align='center'><?php echo $this->Paginator->sort('Type', 'Nintendo.type');?></div></th>
<th><div align='center'><?php echo $this->Paginator->sort('Release', 'Nintendo.release');?></div></th>
<th><div align='center'>Box</div></th>
<th><div align='center'>Manual</div></th>
<?php
if($this->Session->read('Auth.User.admin')){ echo "<th><div align='center'>Action</div></th>";}
?>
</tr>
<?php foreach ($nintendos as $nintendo): ?>
<tr>
<td>
<?php echo $nintendo['Nintendo']['name']; ?>
</td>
<td><div align='center'>
<?php echo $nintendo['Nintendo']['type']; ?>
</div></td>
<td><div align='center'>
<?php echo $nintendo['Nintendo']['release']; ?>
</div></td>
<td><div align='center'>
<?php echo $this->Html->toggleBoolean($nintendo['Nintendo']['box']); ?>
</div></td>
<td><div align='center'>
<?php echo $this->Html->toggleBoolean($nintendo['Nintendo']['manual']); ?>
</div></td>
<?php
if($this->Session->read('Auth.User.admin')){
echo "<td><div align='center'>";
echo $html->image("../img/fam/bin_closed.png", array("alt" => "delete",'url' => array('controller' => 'nintendos', 'action' => 'delete',
$nintendo['Nintendo']['id']),"onclick" => "return confirm(\"Are you sure?\")")); echo " ";
echo $html->image("../img/fam/pencil.png", array("alt" => "edit",'url' => array('controller' => 'nintendos', 'action' => 'edit',
$nintendo['Nintendo']['id'])));
echo "</div></td>";}
endforeach;?>
</table>
Controller
<?php
class NintendosController extends AppController {
var $name = 'Nintendos';
var $paginate = array(
'limit' => 99999,
'order' => array(
'Nintendo.name' => 'asc')
);
function index() {
$this->set('nintendos', $this->paginate());
}
function add() {
if (!empty($this->data)) {
if ($this->Nintendo->save($this->data)) {
$this->Session->setFlash('Your game has been saved.');
$this->redirect(array('action' => 'index'));
}
}
}
function delete($id) {
if ($this->Nintendo->delete($id)) {
$this->Session->setFlash('The game with id: ' . $id . ' has been deleted.');
$this->redirect(array('action' => 'index'));
}
}
function edit($id = null) {
$this->Nintendo->id = $id;
if (empty($this->data)) {
$this->data = $this->Nintendo->read();
}else{
if ($this->Nintendo->save($this->data)) {
$this->Session->setFlash('Your game has been updated.');
$this->redirect(array('action' => 'index'));
}
}
}
}
?>
Helper
<?php
App::import('View', 'Helper', false);
class AppHelper extends Helper {
function toggleBoolean($value){
if ($value == 1)
return "<img src='../img/fam/tick.png' alt='Yes' />";
else
return "<img src='../img/fam/cross.png' alt='No' />";
}
}
?>
[/code]