Home Tutorial Php Zendframework Zend FrameWork Part-9

 
 

Share on Google+Share on Google+
Zend FrameWork Part-9
Posted on: April 19, 2010 at 12:00 AM
Advertisement
In this tutorial we will study about Zend Framwork and we come to know that how to display pages using different components. How to combine all the components to display one page is discussed here.

Zend Framework-9:

Styling:

In this tutorial we left  the styling part of the current project for you, and you can implement the styling part as per your interest and requirement. We will create a folder add a style sheet file(style.css) in public folder css, the name can be select as per your choice.

Listing Books:

Now we will start the displaying part with the help of IndexController class, indexAction() function will display the output as tabular format.

IndexController.php

public function indexAction()

{

// action body

$this->view->title="My Books";

$this->view->headTitle($this->view->title);

$books=new Application_Model_DbTable_Books();

$this->view->books=$books->fetchAll();

}

Index.phtml

<p><a href="<?php echo $this->url(array('controller'=>'index',

'action'=>'add'));?>">Add new book</a></p>

<table>

<tr>

<th>Title</th>

<th>Author</th>

<th>Publisher</th>

<th>&nbsp;</th>

</tr>

<?php foreach($this->books as $book) : ?>

<tr>

<td><?php echo $this->escape($book->title);?></td>

<td><?php echo $this->escape($book->author);?></td>

<td><?php echo $this->escape($book->publisher);?></td>

<td>

<a href="<?php echo $this->url(array('controller'=>'index',

'action'=>'edit', 'id'=>$book->id));?>">Edit</a>

<a href="<?php echo $this->url(array('controller'=>'index',

'action'=>'delete', 'id'=>$book->id));?>">Delete</a>

</td>

</tr>

<?php endforeach; ?>

</table>

 

 

Advertisement

Related Tags for Zend FrameWork Part-9:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 19, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com