Código PHP:
<?php
class models_Model_Dominios extends Zend_Db_Table_Abstract {
protected function _setupTableName()
{
$this->_name = 'dominios';
parent::_setupTableName();
}
public function todos(){
$resultado= new models_Model_Dominios();
return $resultado->fetchAll();
}
public function guardar($datos){
$guardax=new models_Model_Dominios();
$guardax->insert($datos);
}
public function nombrecampdom(){
$todox = new models_Model_Dominios();
$select =$todox->select()->from($todox,array('id','nombre'));
$db = $todox->getAdapter();
return $db->fetchPairs($select);
}
public function getfotos(){
$select=$this->select();
$select->setIntegrityCheck(false)
->from(array("d"=>$this->_name),array("id"))->join(array("e"=>"empresas"),"d.empresas_id=e.id","nombre");
return $this->fetchAll($select);
}
}
Código PHP:
<div class="grid_5">
<?php foreach($this->data as $valor => $i): ?>
<?php echo $valor->id?>
<?php endforeach; ?>
</div>
Código PHP:
class DominiosController extends Zend_Controller_Action{
//put your code here
public function init(){
$this->res=new models_Model_Dominios();
}
public function indexAction(){
$this->view->data=$this->res->getfotos();
}
}