Tag archives for helper

HtmlHelper::tag() method in CakePower

CakePower extends CakePHP’s HtmlHelper without change it’s API. This way you can enjoy powerful functionalities without to change helper names in your sources.

The standard CakePHP code:

$p1 = $this->Html->tag( 'p', 'content of first P' );
$p2 = $this->Html->tag( 'p', 'content of second P', array( 'class'=>'second' ));
echo $this->Html->tag( 'div', $p1.$p2, array( 'class'=>'container' ));

Enjoy CakePower:

echo $this->Html->tag(array(
    'name' => 'div',
    'class' => 'container',
    'content' => array(
        array(
            'name' => 'p',
            'content' => 'content of first P'
        ),array(
            'name' => 'p',
            'class' => 'second',
            'content' => 'content of second P'
        )
    )
));

Continue reading »

Posted in CakePHP | 2 Comments

PowerMenu Helper – how to build menus with CakePower

PowerMenuHelper offers an easy way to generate HTML from PowerMenu‘s data:

// PowerMenu Helper in Action:
echo $this->PowerMenu->generate('sidebar.menu');

Continue reading »

Posted in CakePHP | 1 Comment

CakePHP: Using View Blocks – The CakePOWER way!

View Blocks allow to add content to a logic container during page rendering.

At the end of the story a layout, a view or an element may display some contents fetching it from a container using container’s name.

CakePOWER supplies an helper method to quickly create DOM blocks form View Blocks:

echo $this->Html->block( 'block_name' );

Continue reading »

Posted in CakePHP | 3 Comments

How to use RequireJS with CakePHP – CakePOWER

RequireJS is a library created to load js files asynchronous. It’s objective is to optimize developement and speed up the web page.

I do not cover any RequireJS documentation here. Let me say it ask you to write a piece of code like this in your HTML:

<script src="path/to/require.js" data-main="path/to/script"></script>

where the “src” attribute points to the RequireJS library and the “data-main” attribute points to the main script to be loaded. This is the entry point of your js app and here you can load other modules (AMD).

The problem: “data-main” needs a relative path to the document so you need to write a CakePHP piece of code like that:

// do you really want to write this code??
echo $this->Html->script( 'path/to/require', array(
    'data-main' => $this->Html->assetUrl( 'path/to/script', array(
        'pathPrefix' => JS_URL, 
        'ext' => '.js'
    ))
));

this way the data-main attribute will contain the correct url to the js folder.

CakePower supplies a really easy solution to write above code in a compact and simple way:

// With CakePower loaded into your CakePHP app:
echo $this->Html->script( 'path/to/require', array(
    'data-main' => 'path/to/script'
));

Easy, isn’t it?

Posted in CakePHP | Leave a comment

CakePanel :: PanelFormHelper

The CakePanel’s PanelFormHelper extends CakePHP’s FormHelper and it is aliased to the “Form” object in a View context.

It extends the FormHelper capabilities adding custom behaviors to fit the CakePanel layout.

Continue reading »

Posted in CakePHP | Leave a comment

Swedish Greys - a WordPress theme from Nordic Themepark.