A note on Zend Pagination

Having gone round in so many circles I finally found out that when useing Zend Pagination and the current route you are using has more than one dynamic variable i.e

$router->addRoute(
                'listingswithpage',
                new Zend_Controller_Router_Route(
                        '/listing/:type/:page',
                        array('controller' => 'listing',
                            'action' => 'index')
                )
        );

Your pagination view helper gets a bit thrown if you go by the documentation. The first thing you need to do is find a way to specify the first page initially. I went with specifying my first page in my route definition so it looked something like this

$router->addRoute(
                'listingswithpage',
                new Zend_Controller_Router_Route(
                        '/listing/:type/:page',
                        array('controller' => 'listing',
                            'action' => 'index',
                            'page' => 1)
                )
        );

And that worked. Failing that you have to figure out a way to pass the complete URL path to you pagination view which might be something like “controls.phtml” or “pagination.phtml”. and constructing the url properly there.

I will perhaps post a more detailed description of what this means but leave a comment if you are impatient and I will try and respond when I get a moment.

Posted in php, Web Development, Zend | Tagged , , | Leave a comment

Mod_Rewrite and Zend Framework 1.10.x and Ubuntu

So all the tutorials on configuring your development server to run Zend Framework successfully say that you need to enable mod_rewrite in apache2 so that .htaccess and Zend_Router* works well.

What they all say is to make sure it’s loaded and enabled. I will raise my hand and say it wasn’t that easy for me to find because Ubuntu lays out Apache2 a little differently from say Fedora. First of all in the /etc/apache2 folder there are a few folders to take note of.

sites-enabled and mods-enabled actually tell you what has been enabled or not and not an uncommented list in some httpd.conf file. Basically the folders in there have symbolic links that come from sites-available and mods-available. This perhaps is a better idea as you can add new mods and not have to recompile apache or whatever.

I digress, to enable mod_rewrite in apache2 in Ubuntu 10.04.1 you need to create a symbolic link from mods-available to mods-enabled to do this you can either use the command:

sudo ln -s /etc/mods-available/rewrite.load /etc/mods-enabled/rewrite.load

or if you prefer GUIs you have to run nautilus as root so you can try

sudo nautilus

and navigate to “/etc/mods-available”, right-click on rewrite.load and select “make link” and the cut the new file created called “link to rewrite.load” paste it in mods-enabled and rename it to “rewrite.load ”

Now all you need to do is restart your web server and you’re all set to reroute anyhow you want.

sudo /etc/init.d/apache2 restart
Posted in Linux, MVC Frameworks, php, REST, Ubuntu, Web Development, Zend | Tagged , , , , , | 3 Comments

15 Facts about Net Neutrality

Online MBA Rankings

Posted in General, web services | Tagged , , | Leave a comment