Finally, I completed the basic implementation of Ext.Direct server-side stack for CakePHP.
You can clone a working copy from http://github.com/eabay/directcakephp.
It is not that good but it works!
http://www.extjs.com/forum/showthread.php?t=86501
Combine is still my favorite javascript/css combine and compress script.
I posted a solution how to use it in a CakePHP application and here is a little helper to make it more useful:
<?php
//app/views/helpers/combine.php
class CombineHelper extends AppHelper
{
public $helpers = array('Html', 'Javascript');
private $_pattern = '../combine.php?type=:type&files=:files';
public function js($files)
{
echo $this->Javascript->link($this->_format($files));
}
public function css($files)
{
echo $this->Html->css($this->_format($files, 'css'));
}
private function _format($files = array(), $type = 'javascript')
{
return String::insert($this->_pattern, array('type' => $type, 'files' => implode(',', $files)));
}
}
Add it to controller’s helpers property:
Combine is a small PHP script and some clever URL rewriting designed to speed up the loading of pages that use many or large css and javascript files.
It is good but how can you integrate it with your CakePHP project? And solution comes with the question
.
Download a copy of combine.php and drop it into your “app/webroot” directory (or whatever your application folder name is XXX/webroot/).
A CakePHP component which extends built-in RequestHandler component by adding some useful geolocation information. It requires MaxMind WebService license key to work properly.
Save it with the name request_handler_ext.php into your application components directory under controllers.
You can call the following methods within your controller (e.g. $this->RequestHandlerExt->methodName()):
getClientCountryCode() : ISO 3166 Two-letter Country Code
getClientRegionCode() : Region Code
getClientCity() : City
getClientPostalCode() : Postal Code
getClientLatitude() : Latitude
getClientLongitude() : Longitude
getClientMetropolitanCode() : Metropolitan Code
getClientMetropolitanCode() : Area Code
getClientIsp() : ISP
getClientOrganization() : Organization
I know the title of this post a little bit confusing but let me explain what I want to tell.
You are using CakePHP‘s email component and you should set the same information in each time before you send your email like server address, username, password etc.
Just create a new file mailer.php with the following content and drop it into your CakePHP application components folder (I like convention over configuration!
).