Created
April 22, 2011 09:48
-
-
Save bladeofsteel/936363 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Application_Model_Posts | |
{ | |
public function getPosts() | |
{ | |
$posts = new Application_Model_DbTable_Posts(); | |
$select = $posts->select()->order('created_at DESC') | |
->order('id DESC'); | |
return $posts->fetchAll($select); | |
} | |
} | |
class IndexController extends Zend_Controller_Action | |
{ | |
... | |
public function indexAction() | |
{ | |
// Создаем экземпляр модели постов | |
$posts = new Application_Model_Posts(); | |
// Выполняем запрос | |
$this->view->posts = $posts->getPosts(); | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment