IMPORTANT!

Snipt is going open source. We've toyed with this idea for quite a while, and have finally decided it's the right way to move forward.

A few things:
  • The entire Snipt source code will be released on GitHub under the 3-clause BSD License on Friday, September 10th.
  • While we'd like to think we're perfect, we realize we're only human. By open sourcing the software that runs this website, certain bugs or security flaws may be discovered that could compromise the privacy of your snipts.
  • Only the Lion Burger team will be able to push commits to the Snipt.net site. Contributors should send a pull request to add new features or submit patches.
  • By using this site, you agree not to be too angry or take any legal action against Lion Burger should this whole thing go up in flames some day.
  • Follow us on Twitter for updates.
I agree, close this message
Sign up to create your own snipts, or login.

Latest 100 public snipts » superabbrevs The latest public superabbrevs snipts.

showing 1-9 of 9 snipts for superabbrevs
  • PHP class template
    <?php
    
    /**
     * @author 1:Carlos Pires}
     * @copyright Copyright (c) 2010, 2:2km interativa!}
     */
    
    class ${3:nome da classe} {
    	$end
    }
    ?>
    

    copy | embed

    0 comments - tagged in  posted by cadu on Jan 28, 2010 at 12:36 p.m. EST
  • CakePHP view template
    <div class="${1:nome do controller minusculo no plural} view">
    <h2><?php  __('${2:nome do modelo maiusculo no singular}');?></h2>
    	<dl><?php $i = 0; $class = ' class="altrow"';?>
    		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Id'); ?></dt>
    		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
    			<?php echo $registro['$2']['id']; ?>
    			&nbsp;
    		</dd>
    		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Nome'); ?></dt>
    		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
    			<?php echo $registro['$2']['nome']; ?>
    			&nbsp;
    		</dd>
    	</dl>
    </div>
    <div class="actions">
    	<ul>
    		<li><?php echo $html->link(__('Editar $2', true), array('action'=>'edit', $registro['$2']['id'])); ?> </li>
    		<li><?php echo $html->link(__('Delete $2', true), array('action'=>'delete', $registro['$2']['id']), null, sprintf(__('Você tem certeza que deseja apagar o registro com id %s?', true), $registro['$2']['id'])); ?> </li>
    		<li><?php echo $html->link(__('Listar $2s', true), array('action'=>'index')); ?> </li>
    		<li><?php echo $html->link(__('Adicionar $2', true), array('action'=>'add')); ?> </li>
    	</ul>
    </div>
    

    copy | embed

    0 comments - tagged in  posted by cadu on Jan 28, 2010 at 12:35 p.m. EST
  • CakePHP view related template
    <div class="related">
    	<h3><?php __('Related Posts');?></h3>
    	<?php if (!empty($tag['Post'])):?>
    	<table cellpadding = "0" cellspacing = "0">
    	<tr>
    		<th><?php __('Id'); ?></th>
    		<th><?php __('Categoria Id'); ?></th>
    		<th><?php __('Titulo'); ?></th>
    		<th><?php __('Texto'); ?></th>
    		<th class="actions"><?php __('Actions');?></th>
    	</tr>
    	<?php
    		$i = 0;
    		foreach ($tag['Post'] as $post):
    			$class = null;
    			if ($i++ % 2 == 0) {
    				$class = ' class="altrow"';
    			}
    		?>
    		<tr<?php echo $class;?>>
    			<td><?php echo $post['id'];?></td>
    			<td><?php echo $post['categoria_id'];?></td>
    			<td><?php echo $post['titulo'];?></td>
    			<td><?php echo $post['texto'];?></td>
    			<td class="actions">
    				<?php echo $html->link(__('View', true), array('controller'=> 'posts', 'action'=>'view', $post['id'])); ?>
    				<?php echo $html->link(__('Edit', true), array('controller'=> 'posts', 'action'=>'edit', $post['id'])); ?>
    				<?php echo $html->link(__('Delete', true), array('controller'=> 'posts', 'action'=>'delete', $post['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $post['id'])); ?>
    			</td>
    		</tr>
    	<?php endforeach; ?>
    	</table>
    <?php endif; ?>
    
    	<div class="actions">
    		<ul>
    			<li><?php echo $html->link(__('New Post', true), array('controller'=> 'posts', 'action'=>'add'));?> </li>
    		</ul>
    	</div>
    </div>
    

    copy | embed

    0 comments - tagged in  posted by cadu on Jan 28, 2010 at 12:35 p.m. EST
  • CakePHP index template
    <div class="${1:nome do controler minusculo no plural} index">
    <h2><?php __('${2:nome do model maiusculo no singular}');?></h2>
    <p>
    <?php
    echo $paginator->counter(array(
    'format' => __('Página %page% de %pages%, exibindo %current% registros de %count%, iniciando no %start%, terminando no %end%', true)
    ));
    ?></p>
    <table cellpadding="0" cellspacing="0">
    <tr>
    	<th><?php echo $paginator->sort('ID','$2.id');?></th>
    	<th><?php echo $paginator->sort('Nome','$2.nome');?></th>
    	<th class="actions"><?php __('Actions');?></th>
    </tr>
    <?php
    $i = 0;
    foreach (\$$1 as \$${3:registro}):
    	$class = null;
    	if ($i++ % 2 == 0) {
    		$class = ' class="altrow"';
    	}
    ?>
    	<tr<?php echo $class;?>>
    		<td>
    			<?php echo \$$3['$2']['id']; ?>
    		</td>
    		<td>
            <?php echo \$$3['$2']['${4:campo}']; ?>
    		</td>
    		<td class="actions">
    			<?php echo $html->link(__('Ver', true), array('action'=>'view', \$$3['Tag']['id'])); ?>
    			<?php echo $html->link(__('Editar', true), array('action'=>'edit', \$$3['Tag']['id'])); ?>
    			<?php echo $html->link(__('Deletar', true), array('action'=>'delete', \$$3['Tag']['id']), null, sprintf(__('Você tem certeza que deseja apagar o registro com id # %s?', true), \$$3['$2']['id'])); ?>
    		</td>
    	</tr>
    <?php endforeach; ?>
    </table>
    </div>
    <div class="paging">
    	<?php echo $paginator->prev('<< '.__('anterior', true), array(), null, array('class'=>'disabled'));?>
     | 	<?php echo $paginator->numbers();?>
    	<?php echo $paginator->next(__('próxima', true).' >>', array(), null, array('class'=>'disabled'));?>
    </div>
    <div class="actions">
    	<ul>
    		<li><?php echo $html->link(__('Adicionar $2', true), array('action'=>'add')); ?></li>
    	</ul>
    </div>
    

    copy | embed

    0 comments - tagged in  posted by cadu on Jan 28, 2010 at 12:34 p.m. EST
  • CakePHP edit template
    <div class="${1:nome do controller minusculo no plural} form">
    <?php echo $form->create('${2:nome do model no singular}');?>
    	<fieldset>
     		<legend><?php __('Editar $2');?></legend>
    	<?php
    		echo $form->input('id');
    		echo $form->input('${3:nome do campo}');
    	?>
    	</fieldset>
    <?php echo $form->end('Enviar',true);?>
    </div>
    <div class="actions">
    	<ul>
    		<li><?php echo $html->link(__('Deletar', true), array('action'=>'delete', $form->value('$2.id')), null, sprintf(__('Você tem certeza que deseja apagar o registro com id %s?', true), $form->value('$2.id'))); ?></li>
    		<li><?php echo $html->link(__('Listar $2', true), array('action'=>'index'));?></li>
    	</ul>
    </div>
    

    copy | embed

    0 comments - tagged in  posted by cadu on Jan 28, 2010 at 12:33 p.m. EST
  • CakePHP add template
    <div class="${1:nome do controller no plural} form">
    <?php echo $form->create('${2:nome do model no singular}');?>
    	<fieldset>
     		<legend><?php __('Adicionar $2');?></legend>
    	<?php
    		echo $form->input('${3:nome do campo}');
    	?>
    	</fieldset>
    <?php echo $form->end(__('Enviar',true));?>
    </div>
    <div class="actions">
    	<ul>
    		<li><?php echo $html->link(__('Listar ${2:nome do model no plural}', true), array('action'=>'index'));?></li>
    	</ul>
    </div>
    

    copy | embed

    0 comments - tagged in  posted by cadu on Jan 28, 2010 at 12:33 p.m. EST
  • CakePHP model template
    <?php
    
    /**
     * @version       $Revision: $
     * @lastmodified  $Date: $
     * @author ${1:Carlos Pires}
     * @copyright Copyright (c) 2010, ${2:2km interativa!}
     */
    
    class ${3:nome do model no singular} extends AppModel {
    
    	var $displayField = '${4:nome}';
    	var $validate = array(
    		$end
    	);
    }
    ?>
    

    copy | embed

    0 comments - tagged in  posted by cadu on Jan 28, 2010 at 12:32 p.m. EST
  • CakePHP controller crud
    <?php
    
    /**
     * @version       $Revision: $
     * @lastmodified  $Date: $
     * @author ${1:Carlos Pires}
     * @copyright Copyright (c) 2010, ${2:2km interativa!}
     */
    
    class ${3:Nome do controller no plural}Controller extends AppController {
    
    	var $helpers = array('Html', 'Form');
    
    	function index() {
    		$this->${4:nome do modelo maiusculo no singular}->recursive = 0;
    		$this->set('${5:nome do modelo minusculo no plural}', $this->paginate());
    	}
    
    	function view($id = null) {
    		if (!$id) {
    			$this->_setErro(__('$4 inválida.', true));
    			$this->redirect(array('action'=>'index'));
    		}
    		$this->set('${6:registro}', $this->$4->read(null, $id));
    	}
    
    	function add() {
    		if (!empty($this->data)) {
    			$this->$4->create();
    			if ($this->$4->save($this->data)) {
    				$this->Session->setFlash(__('$4 salva com sucesso', true),'sucesso');
    				$this->redirect(array('action'=>'index'));
    			} else {
    				$this->Session->setFlash(__('Os dados não puderam ser salvos. Por favor, tente novamente.', true),'erro');
    			}
    		}
    	}
    
    	function edit($id = null) {
    		if (!$id && empty($this->data)) {
    			$this->Session->setFlash (__('$4 inválida.', true),'erro');
    			$this->redirect(array('action'=>'index'));
    		}
    		if (!empty($this->data)) {
    			if ($this->$4->save($this->data)) {
    				$this->Session->setFlash (__('$4 alterada com sucesso', true),'sucesso');
    				$this->redirect(array('action'=>'index'));
    			} else {
    				$this->Session->setFlash(__('Os dados não puderam ser salvos. Por favor, tente novamente.', true),'erro');
    			}
    		}
    		if (empty($this->data)) {
    			$this->data = $this->$4->read(null, $id);
    		}
    	}
    
    	function delete($id = null) {
    		if (!$id) {
    			$this->Session->setFlash(__('$4 inválida.', true),'erro');
    			$this->redirect(array('action'=>'index'));
    		}
    		if ($this->$4->del($id)) {
    			$this->Session->setFlash(__('$4 deletada.', true),'sucesso');
    			$this->redirect(array('action'=>'index'));
    		}
    	}
    
    }
    ?>
    

    copy | embed

    0 comments - tagged in  posted by cadu on Jan 28, 2010 at 12:23 p.m. EST
  • CakePHP controller template
    <?php
    
    /**
     * @version       $Revision: $
     * @lastmodified  $Date: $
     * @author ${1:Carlos Pires}
     * @copyright Copyright (c) 2010, ${2:2km interativa!}
     */
    
    class ${3:Nome do controller no plural}Controller extends AppController {
    
    	var $helpers = array('Html', 'Form'$4);
    	
    	function index() {
    	    $end
    	}
    }
    ?>
    

    copy | embed

    0 comments - tagged in  posted by cadu on Jan 28, 2010 at 12:21 p.m. EST
Sign up to create your own snipts, or login.