php

recent posts related to the php programming language

A CakePHP jQuery fade out flash success message

CakePHP flash fade out success messages: If you'd like to show fade out success messages in your CakePHP applications using jQuery, like the ones currently used by applications such as Twitter and Facebook, I thought I'd share the formula I came up with this weekend. While it includes touching a few different files, it's pretty easy, and once you've done the basic setup work you can display CakePHP fade out success messages in all of your web pages, and web applications.

The CakePHP form save, validate, and debug problem

CakePHP form save/validate/debug FAQ: How do I debug problems in the CakePHP form save/validate process?

One problem I've run into with CakePHP is that while the form validation approach works very well 95% of the time, when it fails it can be very hard to debug. Because the form validation process happens when you invoke the save() method, much of this debugging process seems to be out of your control.

CakePHP require, notEmpty, allowEmpty, and form validation

CakePHP require, notEmpty, and allowEmpty FAQ: Help, I'm trying to edit my CakePHP model $validate field to make sure a CakePHP form field is required, but 'require' doesn't seem to be working as expected.

After fighting with a CakePHP form I just got this information beat into my head, so I thought I'd share it here. In short, if you want to make a CakePHP form field required, what you really want to use is the CakePHP notEmpty rule, like this:

Did Drupal account for all new PHP jobs in the last year?

I wish I had more statistics to look at this, but at a preliminary glance, it looks like Drupal has accounted for all new PHP job openings in the last twelve months. I just published a little CakePHP, Drupal, and LAMP PHP jobs survey, and while the good news is that the PHP job market appears to have grown well in the last twelve months, the case can be made -- based on these statistics -- that Drupal accounted for almost all of the new PHP job openings.

CakePHP, Drupal, and LAMP/PHP job market - 2011

CakePHP and Drupal jobs, 2011 - Way back in December, 2009, I first started looking at the PHP job market, specifically CakePHP, Drupal, and LAMP/PHP job openings. I forgot to run the queries again this past December, but I just took a few moments to update them, so ... here is a quick look at the PHP developer job market in January, 2011.

A CakePHP readonly text field

CakePHP readonly text field FAQ: Can I make a readonly textfield in CakePHP (a CakePHP Form input field, or Form text field)?

I haven't worked it all out yet, but I first tried to create a CakePHP readonly text field like this, using the CakePHP Form text object, which doesn't seem to work:

# this doesn't work
echo $this->Form->text('complexity', array('readonly' => 'readonly'));

When that failed I kept poking on the CakePHP Form input object, and was able to create a readonly text field like this:

A CakePHP multiple layouts solution

CakePHP multiple layouts FAQ: How do I use multiple layouts in CakePHP? Also, is there an easy way to switch between different layouts in my CakePHP controllers?

To use multiple layouts in CakePHP, the CakePHP docs tell us to switch layouts in our CakePHP controller functions (actions), like this:

CakePHP jQuery - A default input focus onLoad solution

CakePHP jQuery FAQ: How do I get jQuery to work with CakePHP? (For example, to put default input focus on a textfield when a page loads (the onload event)).

If you haven't already done it, the first thing you need to do is install jQuery to work with CakePHP. Here's a quick CakePHP jQuery installation primer.

CakePHP jQuery installation/configuration

Before beginning, it is important to note that I'm working with CakePHP version 1.3.6, and jQuery version 1.4.4.

CakePHP log output (Where is it?)

CakePHP log file output FAQ: Help, where is my CakePHP log output? I can't find my CakePHP error log output or my CakePHP debug log output.

If you're writing CakePHP log file output as shown in either of these two methods:

CakeLog::write('debug', 'Where is this message going?');
$this->log($this->data, 'debug');

but can't find this CakePHP log output in your Apache log files or PHP log files, fear not, it's somewhere else. That location is:

CakePHP field required validation rule

CakePHP field required validation rule - How to make a CakePHP view field a required field.

I'm still very new to CakePHP, and as a result I just spent thirty minutes fighting with a CakePHP field required rule. In short, if you want a text field to be required, your CakePHP validation rule should look something like this:

Syndicate content