This file contains hidden or 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
//criando a paginaçao | |
Zend_Paginator::setDefaultScrollingStyle('Sliding'); | |
Zend_View_Helper_PaginationControl::setDefaultViewPartial('partials/paginator.phtml'); | |
//manda o paginador usar os dados vindos do banco | |
$paginator = Zend_Paginator::factory($posts->fetchAll()); | |
//pagina atual. Se nao vier nenhuma pagina, mostra a primeira | |
$currentPage = $this->_getParam('page', 1); | |
//5 ítens por página | |
$paginator->setCurrentPageNumber($currentPage)->setItemCountPerPage(5); |
This file contains hidden or 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 if ($this->pageCount): ?> | |
<div class="paginationControl"> | |
<!-- Previous page link --> | |
<?php if (isset($this->previous)): ?> | |
<a href="<?php echo $this->url(array('page' => $this->previous)); ?>"> | |
< Previous | |
</a> | | |
<?php else: ?> | |
<span class="disabled">< Previous</span> | | |
<?php endif; ?> |
This file contains hidden or 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 EmailController extends Zend_Controller_Action { | |
//configuração do exemplo | |
private $smtp = 'smtp.gmail.com'; | |
private $conta = '[email protected]'; | |
private $senha = 'senha'; | |
private $de = '[email protected]'; | |
private $para = '[email protected]'; | |
//envio de e-mail texto |
This file contains hidden or 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
<form method="post" enctype="multipart/form-data" name="form" action="anexo"> | |
Arquivo: <input type="file" name="file" size="30" /> <br /> | |
<input name="Enviar" type="submit" id="Enviar" value="Enviar" /> | |
</form> |
This file contains hidden or 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
$writer = new Zend_Log_Writer_Stream(DATA_PATH . 'zf_log.txt'); | |
$log = new Zend_Log($writer); | |
Zend_Registry::set('log', $log); |
This file contains hidden or 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
$writer = new Zend_Log_Writer_Stream(DATA_PATH . 'zf_log.txt'); | |
$db = Zend_Db::factory("pdo_sqlite", array('dbname'=>DATA_PATH.'zf_log.db')); | |
$columnMapping = array('pri' => 'priority', 'msg' => 'message'); | |
$dbWriter = new Zend_Log_Writer_Db($db, 'log', $columnMapping); | |
$log = new Zend_Log(); | |
$log->addWriter($writer); | |
$log->addWriter($dbWriter); | |
Zend_Registry::set('log', $log); |
This file contains hidden or 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
// Configuring Profiler | |
$profiler = new Zend_Db_Profiler_Firebug('db-profiling'); | |
$profiler->setEnabled(true); | |
$Connection->setProfiler($profiler); |
This file contains hidden or 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 UsersController extends Zend_Controller_Scaffolding { | |
public function init() { | |
parent::init(); | |
//configuração dos campos a serem mostrados | |
$fields = array ( | |
'name' => array ( | |
'title' => 'Nome', | |
'required' => true, |
This file contains hidden or 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 ApiController extends Zend_Rest_Controller | |
{ | |
public function init() | |
{ | |
$this->_helper->viewRenderer->setNoRender(true); | |
$this->_helper->layout()->disableLayout(); | |
if($this->getRequest()->getHeader('apiKey') != 'chave1') { | |
$this->getResponse() |
This file contains hidden or 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
//http://net.tutsplus.com/tutorials/javascript-ajax/learning-serverside-javascript-with-node-js/ | |
//http://www.toxiccoma.com/random/nodejs-0195-http-post-handling-of-form-data | |
var sys = require("sys"), | |
http = require("http"), | |
querystring = require('querystring'); | |
//cria o servidor | |
http.createServer(function(request, response) { | |
post_handler(request, function(request_data) | |
{ |