Posted: February 23rd, 2011

Zend Framework, Subforms and organization

Category: PLAIN, technical
Tags: , , ,

Recently I have been tasked to organize some form fields into nice columns. Normally you would use display groups. Since you really can not nest display groups, subforms were the answer. I have split my elements into 2 different sections and w/in these sections are basic incarnations of forms at the basic level ( utilizing the init() and extending Zend_Form() ). w/in each form I have many elements and display groups.

so in a nut shell here’s what i have,

first off you create "empty" subforms

$left = new Zend_Form_SubForm();    

then you add the subforms you want inside of this "subform"

$left->setSubForms(array(
   ‘sub1′  => $sub1,
   ‘sub2′  => $sub2
));

you do the same thing for the other subform you want to add decorators to.

$right = new Zend_Form_SubForm();    

$right->setSubForms(array(
   ‘sub3′  => $sub3,
   ‘sub4′  => $sub4
));

then to your original form you add these new "$left" and "$right" subforms

$this->setSubForms(array(
   ‘left’  => $left,
   ‘right’ => $right
));

you can then apply decorators to the "$left" and "$right" subforms as you see fit.

since i want to drop the fieldsets that encapsulate the elements inside mine looks like this, you do the same to the other one.

    $left->setDecorators(array(
        ‘FormElements’,
        array(‘HtmlTag’, array(‘tag’ => ‘div’)),
        ));
Posted: February 22nd, 2011

If programming languages were written as essays

Category: images, technical
Tags: , ,

Posted: February 5th, 2011

i’ll just pirate it…

Category: images
Tags: , , , , , , ,

this totally reminds me of the big lebowski. we put the toned down version, but if you want to know what was really said, replace stranger in the alps with one of the above tags

Here you go Larry.
You see what happens?
You see what happens Larry?
You see what happens?
This is what happens Larry.
You see what happens Larry?
You see what happens when you find a stranger in the Alps?
This is what happens.
You see what happens Larry?
You see what happens Larry?

Posted: February 2nd, 2011

Zend_Navigation and Routes

Category: technical
Tags: ,

now here’s my take on the Zend_Navigation and routes. Normally you can set a resource class to do this, but I rather do it in the bootstrap. kinda the same thing in my opinion, i decided not to use a xml config but a ini config type, this way you don’t have to worry if your tags are closed properly. if it works for you awesome.


protected function _initNavigation() {
// set up navigation
$this->bootstrap('layout');
$layout = $this->getResource('layout');
$view = $layout->getView();
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/navigation.ini','navi');
$navigation = new Zend_Navigation($config);
$view->navigation($navigation);
return $view;
}


protected function _initRoutes() {
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/navigation.ini', 'routes');
$front = Zend_Controller_Front::getInstance();
$router = $front->getRouter();
$router->addConfig($config,'routes');
$front->setRouter($router);
return $router;
}

sample ini file

;put routes here.
[routes]
routes.dashboard.route = "/dashboard"
routes.dashboard.defaults.controller = index
routes.dashboard.defaults.action = dashboard


;navigation
[navi]
dashboard.route = "dashboard"
dashboard.controller = index
dashboard.action = dashboard
dashboard.label = dashboard
dashboard.class = dashboard

Your Ad Here
Posted: February 2nd, 2011

snowman o’brian

Category: images
Tags: , , , , ,

With the recent popularity of Conan o’Brian growing, he too is being subject to parody. the latest that team coco’s followers have produced.

Your Ad Here