Skip to content

Instantly share code, notes, and snippets.

View eminetto's full-sized avatar
:octocat:
always learning

Elton Minetto eminetto

:octocat:
always learning
View GitHub Profile
/**
* Inicializa o translate
*
* @return void
* @author Elton Minetto
*/
public function _initTranslate()
{
$config = Zend_Registry::get('config');
$translate = $config->resources->translate;
<?php if (count($this->data) > 0): ?>
<?php foreach($this->data as $d):?>
<h3><?php echo $d['title'];?></h3>
<p><?php echo $d['description'];?></p>
<a href="/post/update/id/<?php echo $d['id'];?>">Atualizar</a><br>
<a href="/post/delete/id/<?php echo $d['id'];?>">Excluir</a><br>
<?php endforeach;?>
<?php echo $this->data;?>
<?php endif;?>
<a href="/post/create">Criar novo post</a>
/**
* Inicializa as rotas
*
* @return void
* @author Elton Minetto
*/
public function _initRoutes()
{
$updateRoute = new Zend_Controller_Router_Route(
'atualizar/:id',
<html>
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<title>Blog</title>
</head>
<body>
<?php
//mensagens de erro
$session = Zend_Registry::get('session');
if(isset($session->erro)) {
<?php
//include do zend
$includePath = get_include_path();
$includePath .= ':/Users/eminetto/Documents/Projects/library.git/';
set_include_path($includePath);
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->setFallbackAutoloader(true);
<snippet>
<content><![CDATA[public function get${1/(.*)/\u$1/}()
{
return \$this->${1:$SELECTION};
}
public function set${1/(.*)/\u$1/}(\$$1)
{
return \$this->$1 = \$$1;
}
class base {
group { "puppet":
ensure => "present",
}
exec { "apt_update":
command => "apt-get update",
path => "/usr/bin"
}
@eminetto
eminetto / Login.php
Created April 27, 2012 13:15
Login form usando Zend_Dojo_Form
<?php
class Application_Form_Login extends Zend_Dojo_Form
{
public function init()
{
$this->setName('Login');
//elementos do Dojo
@eminetto
eminetto / Post.php
Created April 27, 2012 13:18
Exemplo de form usando o Zend_Dojo_Form
<?php
class Application_Form_Post extends Zend_Dojo_Form
{
public function init()
{
$this->setName('Post');
$this->setAttrib('id', 'FormTeste');
@eminetto
eminetto / gist:2509166
Created April 27, 2012 13:20
Layout usando Zend_Dojo
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<?php
Zend_Dojo::enableView($this);
if ($this->dojo()->isEnabled()):
echo $this->dojo();
echo $this->dojo()->addStylesheetModule('dijit.themes.tundra');
endif;