Feed items

CakePHP Quick Tip: $html->clearCrumbs

Hi All

As part of an ongoing project, I was using the CakePHP's htmlHelper to generate breadcrumbs.

Now combined with the tree behavior's getpath function, the $html->addCrumb() and $html->getCrumbs() functions are great and a real time saver, but...

...for this particular page I actually want to show two or more different bread crumb trails, one for location, and one or more for categories, and that's where I hit a snag, as it stands the htmlhelper allows you to keep adding crumbs and displaying the trail so far, but has no way of clearing the protected _crumbs array, should you need to make more than one trail.

AppHelper to the rescue

Since the app_helper file was added to CakePHP you now have the facility to add additional functionality to built in helpers so by adding the following code to app_helper.php:

CakePHP 1.2.0.7692 RC3

Hi all,

Just a quick post to help spread the word, cakePHP RC3 is finally here, and according to Nate's latest post at the bakery, this will be the final release candidate before they finalise the 1.2 version.

From reading through Nate's article, and the change set, It's clear that the team have worked tirelessly on iteration after iteration of performance improvements, to make the framework faster than ever before. By itself, the bootstrap process is over 10x faster than RC2, and basic requests for static content are now about 5x faster overall.

Web Development Resources - Aptana Studio

At the risk of showing my age, it's been nearly 28 years since I wrote my first line of code. Way back in the heady days of ZX Basic on my trusty old ZX Spectrum. Back then to get anything usefull done it was Z80 assembly language or nothing.

Over the years I've used a lot of programming languages and a lot of IDE's, from Hisoft Basic on my Atari ST, through to Delphi and Visual Studio.

Nowadays, I tend to work extensively with both the .NET framework using Visual Studio 2008 and PHP using Aptana Studio.

Quicktips: Finding all the actions in your controller

Hi All,

Thought I'd share a quick tip today for how to automatically detect all the action names within a given controller.

This follows on from my last quicktip, describing how to detect all the controllers in your application and is usefull from witin navigation code or admin back ends.

$actions = get_class_methods($this);

This returns an array where each element is the name of a method within the current controller.

Filtering your results

You can make this more usefull by filtering the actions, for example to remove all the inherited actions from app_controller use:

CakePHP WhoIs Component

Here's one for all you aspiring web hosting ressellers out there, a fast and flexible whois class all wrapped up as a CakePHP component.

The component makes use of the excellent phpWhoIs class which you will need to download, unzip and place in APP/vendors/phpwhois in order for the component to work.

Click here to download phpWhoIs

phpWhoIs - a brief description

This package contains a Whois (RFC954) library for PHP. It allows
a PHP program to create a Whois object, and obtain the output of
a whois query with the Lookup function.

The response is an array containing, at least, an element 'rawdata',
containing the raw output from the whois request.

Database switching in CakePHP

Thought I would share a quick tip today for managing database connections and debug information betwen your local development machine and production server.

Personally I tend to have a version running on my local development machine and on my web server and keep them in synch using the excellent Aptana Studio IDE and the following mean that I can do this without worrying about overwriting my database settings whenever I synchronise.

For starters replace the DATABASE_CONFIG class in APP/config/database.php with the code below, substituting your database login details where applicable: