2010 August

OSI Days 2010 – OpenSource India

Join Zend at Asia’s largest Open Source Conference.  The conference will host a wide variety of PHP sessions including those from Kevin Schroeder, Zend Technology Evangelist:  Building Applications with Zend Framework and Using Zend Server to Run your PHP Applications.

Author:
Source: Zend Events

by News Robot on August 31, 2010 in News, No Comments »
tags: , ,

COMMON 2010 Fall Conference and Expo

Join Zend at COMMON Fall - a three-day Power Systems educational and networking event that will be packed with 112 educational sessions on a large variety of topics.  If you are interested in building a web front-end for RPG, sharing the web with REST and POX, integrating with AJAX or learning Object Oriented model of PHP, join Mike Pavlak who will be delivering various sessions on “PHP and IBM i”.

Author:
Source: Zend Events

by News Robot on August 30, 2010 in News, No Comments »
tags: , ,

The Redirector action helper

Following on from the discussion on the FlashMessenger action helper, I thought I’d also cover another supplied helper: Redirector.

Redirector does what it says on the tin and redirects the user to another page. I mostly use this when coming back from filling a form in, so that the user is then redirected to another page. In admin systems, this is usually a list page. On front end websites, this is usually a thank you page. Though for log-in forms, I tend to try and return the user to where they were going!

It’s used in a controller action method like this:

$urlOptions = array('controller'=>'index''action'=>'index');
$this->_helper->redirector->gotoRoute($urlOptions);

gotoRoute() takes the same set of parameters are the url() view helper which is not a surprise as they both proxy through to the Front Controller’s router object. It’s handy though as one you know one, you know the other :)

If you are using the default route, then you can use gotoSimple(). For example to redirect to the news controller’s list action, you would do:

$this->_helper->redirector->gotoSimple('list''news');

The gotoSimple() method signature is:

gotoSimple($action$controller null$module null, array $params = array());

As you can see, it provides defaults for the controller and module and params parameters so you only need to set them if you need to. This works well for admin system as I tend to be redirecting within the same controller (from the edit or delete action to index, usually).

You can also use the Redirector with an absolute URL, by using the gotoUrl() method:

$url 'http://www.akrabat.com';
$this->_helper->redirector->gotoUrl($url);

I tend to use this one much less frequently – so infrequently, that I can’t think of a use-case off the top of my head :)

By default, Redirector sets a 302 status code, however you can also set a 301 if you want to:

$this->_helpers->redirector->setCode(301);

There are a few other options that can be set like setExit() and setUseAbsoluteUri(), but to be honest, I don’t think I’ve ever used them!

I find that I use Redirector fairly frequently as its gotoRoute() uses the same parameters as url() which makes it easy to remember how to use it. Like url(), it also benefits from remembering which route was used to get you to the current page and reuses that when creating the next one which is handy.

Author: Rob…

Integrating Doctrine with Zendframework for modules

When I started learning PHP framework I started with symfony-project . Doctrine was one of the coolest feature I loved. So I thought of learning Doctrine to use with Zend-framework . Recently I was looking  zendcasts.com to integrate doctrine with zend-framework . I think Jon didn’t get much time to think about this solution else he may have come with it .

read more

Author: hari

by News Robot on August 30, 2010 in News, No Comments »
tags:

Adding theme support to your Zend Framework application

This is a brief explanation on how to add theme support to your Zend Framework application and how to ensure those themes are self-contained, easy to distribute and install.

Themes are very powerful and extremely easy to develop. They allow you to quickly switch between layouts and change the look and feel of your application. You can use themes to show, for example, a mobile friendly version of your site.

Making a Zend Framework application theme-able is a three-step process.

First, modify your directory structure:

application/
    controllers/
library/
public/
    themes/
        default/
            css/
            images/
            templates/
        custom/
            css/
            images/
            templates/

Then, edit your Bootstrap class:

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    protected function _initView()
    {
        $theme = 'default';
        if (isset($this->config->app->theme)) {
            $theme = $this->config->app->theme;
        }
        $path = PUBLIC_PATH.'/themes/'.$theme.'/templates';

        $layout = Zend_Layout::startMvc()
            ->setLayout('layout')
            ->setLayoutPath($path)
            ->setContentKey('content');

        $view = new Zend_View();
        $view->setBasePath($path);
        $view->setScriptPath($path);

        return $view;
    }
}

And finally, copy your view scripts and layouts to the templates directory:

application/
library/
public/
    themes/
        full-site/
            css/
            images/
            templates/
                error/
                index/
                partials/
                layout.phtml
        mobile-site/
            css/
            images/
            templates/

Voila, mission accomplished.

Posted in Frameworks, Open-source, PHP

Author: Federico

by News Robot on August 29, 2010 in News, No Comments »
tags: ,