source code bean

Archive for the ‘PHP’ Category

06 Jun, 2010

Two new features I really like in PHP 5.3

Posted by: Peter In: PHP

Namespaces
Finally PHP has support for namespaces, not a day too late! Before the days of object oriented PHP name clashes for functions was usually prevented by adding a prefix to your function names. When object oriented PHP was introduced function name clashes was less likely, but class names still had to be unique, ie you [...]

14 Feb, 2010

Articles coming up on CouchDB and ExtJS

Posted by: Peter In: PHP

It has been a bit too long since my last post so I wanted to give you an short update on what I have been up to lately. Last year I built a web service using Amazon SimpleDB, which got me interested in document based databases. Since then I have been reading and following the [...]

In this post I am going to show how easy it is to create a JSON-RPC web service using the built in support in Zend Framework.
First we need to create the php-file that will handle the incoming RPC calls. It is not advised to put this inside the MVC structure of a Zend web application, [...]

Today I upgraded a project we started working on last year from Zend Framework 1.7 to Zend Framework 1.9. I excepted to run into several API incompatibilities, but the only problem I got was the autoloader.
In Zend 1.7, and earlier versions, the autoloader was registered like this:

 

require_once "Zend/Loader.php";

Zend_Loader::registerAutoload();

 

In Zend Framwork 1.9 this has changed slightly, [...]

13 Dec, 2009

Getting started with the Zend Framework

Posted by: Peter In: PHP| Web| Zend Framework

It used to be a bit tricky to get started with the Zend Framework. The Zend Framework is very flexible and allows you to set it up in almost any way that fits your needs. This means for example that the directory structure and location of files is up to you, however – there is [...]

23 Feb, 2009

Friendly URLs and the Zend Router

Posted by: Peter In: PHP| Zend Framework

Creating custom friendly URLs using the Zend framework is really simple. The default routing setup for Zend is : ‘:module/:controller/:action/*’, (* will match any var/value) which is fine for most setups. However on some pages having the var/value might not look very good, for example this url is not very readable:
/popular/index/type/images/page/1/sortOrder/alltime (controller/action/var/value/var/value/var/value)
We [...]

Zend Framework ships with several View Helpers, such as the url View Helper. Anywhere in a view script one can call $this->url() to generate a url to a certain page. For example:

$this->url(array(

  ‘module’ => ‘moduleName’,

  ‘action’ => ‘actionName’,

  ‘additionalParam’ =>‘value’))

I wanted to create my own helper, for generating paths to thumbnails, and it turned out [...]


Categories

Adwords

Twitter Updates


    • Petan: I got in bootstrap this (insted of $frontController->getRouter()): $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/routes.ini', 'rout
    • oanh tong ngoc: :) It's usefull but could U give everyone's an example with a project source code. Thanks
    • Peter: Hi Sohaib, It seems like the rewrite module isn't loaded by IIS. Have you uploaded the UrlRewriter dlls and made the changes to web.config on the ser

    About

    Welcome to source code bean! You will find information on tips and tricks on programming languages, server side stuff, and anything that causes troubles to web development.