Skip to content

Instantly share code, notes, and snippets.

View nebiros's full-sized avatar

Juan Alvarez nebiros

View GitHub Profile
@nebiros
nebiros / IndexController.php
Created January 28, 2010 13:13
Export data to excel on Zend Framework
<?php
class IndexController extends Zend_Controller_Action
{
public function exportXlsAction()
{
set_time_limit( 0 );
$model = new Default_Model_SomeModel();
$data = $model->getData();
@nebiros
nebiros / ErrorController.php
Created January 15, 2010 18:40
Display AJAX errors on Zend Framework
<?php
class ErrorController extends Zend_Controller_Action
{
public function errorAction()
{
/** Other suff */
if ( true === $this->getRequest()->isXmlHttpRequest() )
{
@nebiros
nebiros / index.php
Created January 14, 2010 15:53
How to implement Zend_Paginator without Zend
<?php
defined( "APPLICATION_PATH" )
|| define( "APPLICATION_PATH", realpath( dirname( __FILE__ ) ) );
// Ensure library/ is on include_path.
set_include_path( implode( PATH_SEPARATOR, array(
realpath( APPLICATION_PATH . "/library" ), // Aca va a estar la carpeta Zend que viene con el .tag.gz del ZF
get_include_path(),
) ) );
#
# How to install php/java bridge on Ubuntu.
#
# aptitude install sun-java6-jre sun-java6-fonts sun-java6-jdk liblucene-java libitext-java \
php5-dev php5-cgi libtcnative-1
# update-java-alternatives -s java-6-sun
# dpkg --force-architecture -i php-java-bridge_5.4.4.2-3_i386.deb
@nebiros
nebiros / IndexController.php
Created November 30, 2009 12:56
Zend_Filter_Input on steroids
<?php
class IndexController extends Zend_Controller_Action {
public function someAction() {
if ( true === $this->getRequest()->isPost() ) {
// Validate form.
$someForm = new App_Filter_Input_SomeForm();
$someForm->setData( $this->getRequest()->getPost() );
if ( false === $someForm->isValid() ) {
@nebiros
nebiros / mb_str_pad.php
Created November 4, 2009 20:30
mb_str_pad
<?php
/**
* mb_str_pad
*
* @param string $input
* @param int $pad_length
* @param string $pad_string
* @param int $pad_type
* @return string