Jump to content

masa_ash

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

masa_ash's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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]
  2. Hello, I am creating a simple catalog feature on my website for logging collections in a list format. Using built in pagination (cakephp) on my list to sort by name, I lose my images after the sort. Any ideas how to get around this? Here is the code. View: <td><div align='center'> <?php echo $this->Html->toggleBoolean($nintendo['Nintendo']['box']); ?> </div></td> 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' />"; } Regards, Ash
  3. Hello Everyone, First of all, let me introduce myself. I'm Ash, from Canada and work in the IT industry. I am new to PHP. I have about 1 year of "real world" experience in programming (Ruby) and have taken courses here and there. Anyways, So I have a working, simple app to add my games collection to my server to access from anywhere. All is great. Here is my issue however, I work a lot.. I have no access to FTP or a PHP webserver at work, so I can't look at code and edit it while there. Also, Remote Desktop is out of the question. So, is there an application or a simple way, such as similar myPHPadmin, to manage my text documents from my webserver while I am on the go so I can +1 my PHP skills. Asking the community because I am not sure where to search. Regards, Ash
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.