Articleshttp://bakery.cakephp.org/Latest Articlesen-usCakephp application + Netbeans + Remote Access + SSHhttp://bakery.cakephp.org/articles/syl-via/2012/02/08/cakephp_application_netbeans_remote_access_sshhttp://bakery.cakephp.org/articles/syl-via/2012/02/08/cakephp_application_netbeans_remote_access_sshJust in case someone is searching for a working way of configuring remote server in Netbeans to work with cake application, here goes good tutorial: http://www.thewebshop.ca/blog/2009/07/working-with-remote-files-in-netbeans/Good luck!TutorialsWed, 08 Feb 2012 15:43:06 +0000Running CakePHP using the Facebook's HipHop compilerhttp://bakery.cakephp.org/articles/lorenzo/2012/01/30/running_cakephp_using_the_facebooks_hiphop_compilerhttp://bakery.cakephp.org/articles/lorenzo/2012/01/30/running_cakephp_using_the_facebooks_hiphop_compilerFacebook surprised the PHP community in early 2010 when announced they managed to write a compiler for PHP to produce C++ code. Being PHP the most popular language for web applications, it faces a lot of competition from other languages toposition themselves as the fastest language out there, buy this announcement was a real game changer as it is hard toargue against the speed of compiled machi...TutorialsMon, 30 Jan 2012 04:14:58 +0000CakePHP 2 and launchd on Mac OS X 10.6http://bakery.cakephp.org/articles/benni/2012/01/12/cakephp_2_and_launchd_on_mac_os_x_10_6http://bakery.cakephp.org/articles/benni/2012/01/12/cakephp_2_and_launchd_on_mac_os_x_10_6# The shellThe shell itself can be any shell you want and/or have already written. For details on this refer to the cake book, section [Creating a Shell]. # The command to run the scriptIn the cakebook in a section close to the one linked above, the writers propose a short shell script which makes sure the paths are set right – however, we don't need that on our shiny Mac OS systems. Instead, w...TutorialsThu, 12 Jan 2012 14:29:46 +0000TinyAuth ACL - fast and easyhttp://bakery.cakephp.org/articles/euromark/2011/12/31/tinyauth_acl_-_fast_and_easyhttp://bakery.cakephp.org/articles/euromark/2011/12/31/tinyauth_acl_-_fast_and_easy**Basic Setup**The ini file `acl.ini` will be in /Config/ and is as easy as it gets:[Tools.Countries]* = superadmin ; this is a comment [Account]edit,change_pw = * [Activities]admin_index,admin_edit,admin_add,admin_delete = admin,superadminindex = * [Users]index,search = user* = moderator,adminMost of it is probably self-explanatory.You don't even have to provide a roles table. If you don't man...TutorialsSat, 31 Dec 2011 12:30:21 +0000Start your own bouncely and report mail bounces with a gmail and cakephphttp://bakery.cakephp.org/articles/eugenioclrc/2011/12/06/start_your_own_bouncely_and_report_mail_bounces_with_a_gmail_and_cakephphttp://bakery.cakephp.org/articles/eugenioclrc/2011/12/06/start_your_own_bouncely_and_report_mail_bounces_with_a_gmail_and_cakephpIngredients:* 1 gmail account* install the php5-imap * add the Return-path header to your outgoing mails with the gmail mail or use the gmail account for send mails* 1 gmail filter[b]Step 1[/b]Add the return path in the sending process:[code]$gmailaccount='mybounces@gmail.com';$mailheader ="Content-Type: text/plain;\nReturn-Path: $gmailaccount\n";mail; [/code][b]Step 2[/b]Add the gmail filter; ...TutorialsTue, 06 Dec 2011 03:29:15 +0000Testing with Virtualbox and Vagranthttp://bakery.cakephp.org/articles/connrs/2011/11/04/testing_with_virtualbox_and_vagranthttp://bakery.cakephp.org/articles/connrs/2011/11/04/testing_with_virtualbox_and_vagrant<p>I procrastinated, for a very long time, about which projects I'd start practising tests with; I've long admired people who wrote tests for code, but I'd never done it formally before for my own projects. I'd written tests for a few JS projects that I'd contributed to; but, as they already had a solid system in place, I simply needed to copy a few lines of existing test code and change it to mee...</p>TutorialsFri, 04 Nov 2011 14:33:53 +0000How to save core configurations to database tablehttp://bakery.cakephp.org/articles/ihs1301/2011/10/27/how_to_save_core_configurations_to_database_tablehttp://bakery.cakephp.org/articles/ihs1301/2011/10/27/how_to_save_core_configurations_to_database_tableCREATE TABLE IF NOT EXISTS `settings` NOT NULL auto_increment, `name` varchar NOT NULL, `value` varchar NOT NULL, `type` varchar NOT NULL, `notes` varchar NOT NULL, `mutable` tinyint NOT NULL, PRIMARY KEY ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=117 ;---- Dumping data for table `settings`--INSERT INTO `settings` VALUES,,,,,,,,,, weights can be changed in products module. ', 1),TutorialsThu, 27 Oct 2011 18:15:58 +0000RewriteBase config for cake installation with userDir and mod_rewrite http://bakery.cakephp.org/articles/syl-via/2011/09/19/rewritebase_config_for_cake_installation_with_userdir_and_mod_rewritehttp://bakery.cakephp.org/articles/syl-via/2011/09/19/rewritebase_config_for_cake_installation_with_userdir_and_mod_rewriteIf the cake app is installed in ~/user/cake_install/, than to correctly configure the RewriteBase you will need to edit 3 .htaccess files:~/user/cake_install/.htaccess~/user/cake_install/app/.htaccess~/user/cake_install/app/webroot/.htaccessadding the directive: RewriteBase as follow: [code]Path ---- RewriteBase~/user/cake_install/.htaccess ---- RewriteBase /~user/cake_install/~/user/cake_insta...TutorialsMon, 19 Sep 2011 12:42:41 +0000Flexible on-the-fly AJAX Validatorhttp://bakery.cakephp.org/articles/dispy/2011/08/13/flexible_on-the-fly_ajax_validatorhttp://bakery.cakephp.org/articles/dispy/2011/08/13/flexible_on-the-fly_ajax_validatorLet's begin with the ExtendedForm helper. It's basically a child of the well-known Form-Helper and inherits from it too - it just modifies the input-method to enable an intuitive way of enabling AJAX-Validation. [b]views/helpers/extended_form.php[/b][code]?php App::import; class ExtendedFormHelper extends FormHelper{ var $helpers = array; /** * Add Ajax-Validator flag to options of FormHelper-i...TutorialsSat, 13 Aug 2011 23:06:20 +0000Search and paginate methods in cakePHP 1.3 or 1.2http://bakery.cakephp.org/articles/2011/06/11/search_and_paginate_methods_in_cakephp_1_3_or_1_2http://bakery.cakephp.org/articles/2011/06/11/search_and_paginate_methods_in_cakephp_1_3_or_1_2In this toturial we will use GET method to submit our search keyword.In controller you should create Search function using an argument like this:<pre>class ItemsController extends AppController {...function search{ ... //This is an example code to gain the Keyword from argument or querystring or data arrayif)$keyword = )? Sanitize::clean):Sanitize::clean);$keyword = )?Sanitize::clean):Sanitize::clea...</pre>TutorialsSat, 11 Jun 2011 08:49:13 +0000PHPMailer and Cakehttp://bakery.cakephp.org/articles/scoutmastershake/2011/05/27/phpmailer_and_cake_2http://bakery.cakephp.org/articles/scoutmastershake/2011/05/27/phpmailer_and_cake_2First what you need to do is go through class.phpmailer.php and find all the lines that have echo in them and change the echo to $this-SetError;Example:[code] private function AddAnAddress { if $/', $kind)) { $this-SetError; //this was echo return false; } $address = trim; $name = trim); //Strip breaks and trim if ) { $this-SetError.': '. $address); //this was echo if { throw new phpmailerExcep...TutorialsFri, 27 May 2011 15:24:35 +0000Array Structures, the Recursive Property and the Set Classhttp://bakery.cakephp.org/articles/daveym/2011/05/08/array_structures_the_recursive_property_and_the_set_classhttp://bakery.cakephp.org/articles/daveym/2011/05/08/array_structures_the_recursive_property_and_the_set_class<p>So, I decided to play around a bit with some of the associations on the dev site I set up to try out the 'Blog' and 'Simple Aclo controlled Application' tutorials. I used CakePHP 1.2.5 for this, because that's what was current when I first set the dev site up!</p><h4>recursive = -1</h4><p>Say we have a model, for example, for our application's users, represented by M. If we perform a find operation on it such ...</p>TutorialsSun, 08 May 2011 16:54:16 +0000Forking CakePHP shellshttp://bakery.cakephp.org/articles/webjay/2011/02/21/forking_cakephp_shellshttp://bakery.cakephp.org/articles/webjay/2011/02/21/forking_cakephp_shells<code>private function start_bot {$pid = pcntl_fork;if { // fork errorreturn false;} else if { // we are the parentreturn $pid;} else { // we are the child// reconnect DB$db =& ConnectionManager::getDataSource;$db->reconnect;// start bot. // do_stuff can be used to do background stuff.$this->do_stuff;}}</code>TutorialsMon, 21 Feb 2011 11:23:22 +0000Fulltext search and i18nhttp://bakery.cakephp.org/articles/macjoost/2011/02/17/fulltext_search_and_i18nhttp://bakery.cakephp.org/articles/macjoost/2011/02/17/fulltext_search_and_i18nFirst, add a `FULLTEXT` index to your i18n table:`ALTER TABLE `i18n` ADD FULLTEXT `content` ;`For your query, you need to create an "OR" condition with an entry for every field you want to add to your search. In my example, I search the 'title' and 'description' fields.The "I18n__" prefix for your fieldname is the automagic CakePHP naming for your i18n content relations.`$conditions = array);fo...TutorialsThu, 17 Feb 2011 15:14:17 +0000Fulltext search and i18nhttp://bakery.cakephp.org/articles/macjoost/2011/02/17/fulltext_search_and_i18nhttp://bakery.cakephp.org/articles/macjoost/2011/02/17/fulltext_search_and_i18nFirst, add a `FULLTEXT` index to your i18n table:`ALTER TABLE i18n ADD FULLTEXT content ;`For your query, you need to create an "OR" condition with an entry for every field you want to add to your search. In my example, I search the 'title' and 'description' fields.The "I18n__" prefix for your fieldname is the automagic CakePHP naming for your i18n content relations.`$conditions = array);foreac...TutorialsThu, 17 Feb 2011 15:15:53 +0000Fulltext search and i18nhttp://bakery.cakephp.org/articles/macjoost/2011/02/17/fulltext_search_and_i18n_1http://bakery.cakephp.org/articles/macjoost/2011/02/17/fulltext_search_and_i18n_1First, add a FULLTEXT index to your i18n MySQL table:[code]ALTER TABLE `i18n` ADD FULLTEXT `content` ;[/code] For your query, you need to create an "OR" condition with an entry for every field you want to add to your search. In my example, I search the 'title' and 'text' fields of a Post model.The "I18n__" prefix for your fieldname is the automagic CakePHP naming for your i18n content relations...TutorialsThu, 17 Feb 2011 15:19:45 +0000Configuring memcache in cakephp on ubuntuhttp://bakery.cakephp.org/articles/rajender120/2011/02/02/configuring_memcache_in_cakephp_on_ubuntuhttp://bakery.cakephp.org/articles/rajender120/2011/02/02/configuring_memcache_in_cakephp_on_ubuntuScope : Configuring memcache functionality in cakePHP on ubuntu flavor. Steps might change little bit for other OS. Pre-requirement : Apache, PHP, mysql and cakePHP should be properly installed and configured. Assuming default installation of cakephp on ubuntu machine in /var/www/cake with document root as /var/www, to check if cakephp is working fine or not, open http://localhost/cake. It shou...TutorialsWed, 02 Feb 2011 13:21:05 +0000how to create an observeField equivalent in the new JsHelperhttp://bakery.cakephp.org/articles/Calderoy/2011/01/18/how_to_create_an_observefield_equivalent_in_the_new_jshelperhttp://bakery.cakephp.org/articles/Calderoy/2011/01/18/how_to_create_an_observefield_equivalent_in_the_new_jshelperFor those of you who are migrating from cakephp 1.2 to 1.3:let's say we have two select boxes .I want to automatically select the right author when a book is selected:Instead of using:[code]echo $ajax-observeField )") );[/code]Use:[code]$this-Js-get-event,array)) ) );[/code]the serialize function sends the form data to the php action so we can see which option was selected and decide what to up...TutorialsTue, 18 Jan 2011 02:29:55 +0000session setflash with cool jquery effectshttp://bakery.cakephp.org/articles/webdevbit/2010/12/07/session_setflash_with_cool_jquery_effectshttp://bakery.cakephp.org/articles/webdevbit/2010/12/07/session_setflash_with_cool_jquery_effectsHi there, I have something new for cakephp developers to customize their setflash messages. I can't say it much different, but I have added some cool css and jquery effects to it. So it looks different then simple cakephp flash message. So let us start.1. Add jquery file to your layout or view file. You can download it from here.2. Add some jQuery code into your layout file or create another se...TutorialsTue, 07 Dec 2010 08:00:51 +0000In Place Editing with jQueryhttp://bakery.cakephp.org/articles/abalonepaul/2010/12/04/in_place_editing_with_jqueryhttp://bakery.cakephp.org/articles/abalonepaul/2010/12/04/in_place_editing_with_jqueryI am assuming that you are using CakePHP 1.3 or greater and the Js Helper with jQuery. For our example, we are going to use a simple contact form with fields for the contact's name and the contact's state.The first thing you need to do is download the jQuery In Place Editor Plugin from [url=http://code.google.com/p/jquery-in-place-editor/downloads/list]here[/url]. Unzip the file and put jquery....TutorialsSat, 04 Dec 2010 17:37:57 +0000