Cake PHP

Posted by jeff.griffiths on 2008-09-18 22:19 | Staff Pick!
Wed, 2011-03-23 18:18
  • : 4.1 - 6.*
  • : 4.1 - 6.*

This extension adds code intelligence support for View scripts when using CakePHP. This initial version doesn't do much, except implement some extra magic to import the standard cake helpers into view files, either *.ctp for CakePHP 1.2 or *.thtml for CakePHP 1.1. The extension should offer the correct set of helpers depending on which version of Cake you are using.

Please try this out with your Cake projects and let me know what you think; I don't have a lot of experience with Cake and am *sure* I'm missing something. As well, it is totally possible to integrate cake's console through Komodo's Project Template features. I'd be interested to hear people's opinions about what an ideal workflow would be for this.

Update to 0.2: at HeathNail's suggestion, I allowed the magic to happen for any ctp file in a views folder.

Update 0.3: added support for .thtml files in Cake 1.1, and added additional helpers for Cake 1.2.

Update 0.4: based on additional suggestions from Heath, I've added some additional code intelligence support for CakePHP:

  1. The related model is now added as a property to the controller class.
  2. There is now limited support for model associations. By limited, I mean
    that Komodo will be able to derive the associated model for the $hasOne and
    $belongsTo cases if you use the 'simple syntax eg:
          class Foo {
            var $hasOne = 'Bar';

    I have not yet tackled the more complicated array syntax for defining associations, nor have I done a lot of testing, so post back if you run into problems, or email me directly at jeffg (at) activestate (dot) com.

Update 0.5: hasMany associations should now be correctly handled as well.

Update 0.6: made compatible with Komodo 6.

Cake Autocomplete

The source code for this add-on is available here:

adam | Fri, 2008-09-19 01:17

This is possible to do without the extension but what about the $this-> in views?
Check below:

xyz | Fri, 2010-05-07 04:48

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
shelving units|

xyz | Tue, 2010-05-11 04:28

web development :-Website Design, Web Design, Web Development, Website Development
Services Provided By Click Consult

jeff.griffiths | Fri, 2008-09-19 14:07

That's actually the main improvement so far over the previously discussed method. $this is now seen by Komodo as an instance of Cake's 'View' class.


sitedyno | Fri, 2008-09-19 16:30

The search looks for app/views/ but not everyone will have this folder structure. Actually the more cake projects you do the less likely you are to use the app folder. It would probably work better to have only views/ as a search parameter. I'm referring to line 70 of

if filepath.endswith(".ctp") and filepath.find("/app/views/") > 0:

Thanks for putting this together :) I will be using it :)

jeff.griffiths | Fri, 2008-09-19 17:31

..and exactly the kind of feedback I was looking for, being a bit of a Cake newb. I've updated the extension, let me know if you run into any issues.


adam | Mon, 2008-09-22 04:17

It works great with local installation of cakephp but what about working on remote server.
Adding local cake path to Prefs/Langs/PHP works only for controllers and models.
Adding also .thtml extension for older version of cake would be also great :)

adam | Mon, 2008-09-22 05:43

Why not to change to this:
if filepath.endswith(".ctp") or filepath.endswith(".thtml"):
Will work also on remote files and with all versions of cake. Will work on every directory structures.
Additional thing that should be done is to separate old (deprecated) cake code form new (.ctp from .thtml). If autocomplete could be assigned for proper versions (means 1.1 functions to .thtml and 1.2 to .ctp) that would be almost perfect ;-)

canuckistani | Mon, 2008-09-22 13:14

I had wondered about older versions of Cake, but decided to go ahead with the 1.2 because it is what the Cake site pushes. It should be possible to do this by processing the codeintel buffer differently depending on the file extension. I'll try to take a look at this tonight or tomorrow.

adam | Tue, 2008-09-23 04:21

There are many websites using cake 1.1 and needs modifications all the time.

jeff.griffiths | Tue, 2008-09-23 09:12

I just updated the extension to 0.3 with support for .thtml files and what I believe is a better set of helpers present for CakePHP 1.2. Try to check it out and let me know if you have any problems or suggestions. =)


adam | Tue, 2008-12-30 03:50

What about custom helpers? Is this extension work with it?

tokuiti | Sat, 2009-08-08 07:23

Please use inflector to pluralize or sigularize nouns.

- Python Inflector

eksi | Sun, 2009-09-27 02:15

Do you think about write post about CodeIgniter framework ?

(from eksi ..)

gernebet | Mon, 2010-03-08 02:31

Thank you very much. I was looking for

catharso | Fri, 2010-10-29 03:12

Hi JeffG,

i really loved this little addon, so i'm pretty sad that it does not work with the komodo edit > 6.

Are there any plans to make it compatible?
I have no experience with python, so i'd rather leave it to someone who does.

If there are no plans/activities, maybe you can give a guess if major changes are necessary or if a small adjustment would suffice.
I will then try it myself :/

canuckistani | Fri, 2010-10-29 15:10


For a combination of reasons ( I no longer work for AS, I don't really use CakePHP that much, etc ) I don't really intend to maintain this extension, however the code is still available on firefly:

I'm not familiar with the changes that have been made to Komodo 6 that might affect this extension. The first step would be to update the Komodo version compatibility numbers in the install.rdf file.

cheers, Jeff

ActiveState Staff
Wed, 2010-11-24 12:14

I've updated the add-on to support Komodo 6 (by just tweaking the install.rdf).

The code for this add-on is now available through the openkomodo addon repository:


sams | Thu, 2011-03-03 09:36

I need to see some docs on SubElement specifically trying to find out how to have subelement accept args to set up assigning helpers to props of the view

                tmp_method = ET.SubElement(view_method, "scope",
                                        attributes="__fabricated__ __hidden__",

- Sams

using Komodo with to make working with cakephp, git and other fun stuff

ActiveState Staff
Thu, 2011-03-03 11:21

You can find ElementTree docs here:

BTW, here is the code that the Zend helper uses (might be useful as a reference):

You can also find references to Komodo's CodeIntel use of elementtree in Grok:


styks1987 | Tue, 2011-07-12 13:03

I am really looking forward to when this is completed. Please keep us updated on when this is ready for 1.3.

thanks for your work!

luckysmack | Fri, 2012-03-30 13:38

I'm wondering if there is any plans on un updating this to be available in Komodo 7 as well as having support for Drupal 7 and CakePHP 2.x

ActiveState Staff
Mon, 2012-04-02 15:41

It's certainly possible to update the add-on, though I'm not sure what changes/hooks are required to support the latest CakePHP version... Drupal 7 should work in Komodo without the need for an add-on.


chandra | Sat, 2012-12-08 08:07

Hello ,

I am new to cake. can you suggest me how to configure the cakephp-0.6-ko file on komodo to get auto rendering feature. please help me. It is very important for me.

thank you