Fork me on GitHub

Other articles


  1. CakePHP Getting Tree Path

    In a reversal of yesterday's post is today's, getting a path to a node, or nodes. Basically we just use the core getpath() function of the Tree behavior and traverse that path.

    function setTreePath(&$data, $path='tree_path', $label='name') {
        if (!is_array($data) || !in_array('Tree', $this->actsAs)) {
            return $data ...
    read more

    There are comments.

  2. CakePHP Tree Find By Path

    Wrote these little functions to help with finding tree nodes by specifying a path of values. For example if we had a tree of categories with similar names like TVs->Color and Movies->Color, we can't find by the category name since its not unique, but we can search ...

    read more

    There are comments.

  3. CakePHP Lightbox Helper

    Made a helper to output lightbox compatible links, since the core HTML helper was not working. Stick the following code in app/view/helpers/lightbox.php:

    class LightboxHelper extends AppHelper {
    
        var $helpers = array('Html');
    
        function img($thumb, $full, $imgAttributes = array(), $linkAttributes = array()) {
            $defaultLinkAttributes = array('rel'=>'lightbox');
            $linkAttributes = array_merge($defaultLinkAttributes, $linkAttributes ...
    read more

    There are comments.

  4. Using Radio Buttons with CakePHP

    There's sparse documentation on this topic so here I give some example usages. Say we have a Posts model like in most of the cake documents. Basically what we do is make an options array available to the template that contains the keys and values for the radio button ...

    read more

    There are comments.

  5. Page 1 / 1

blogroll

social