Posts tagged ‘Helpers’

Helpers

Helpers in Magento are simply a way to abstract (or refactor) utility methods out of core classes. Most access to helpers are doubly wrapped up inside various Block and Model methods anyway, so the value of helpers is pretty dubious. Very rarely do you want to override or sub-class a helper. It is very easy to simply add a new helper to provide additional utility functionality to your scripts. The two major methods of helpers that you should be interested in are:
• __ (just two underscores)

• htmlEscape
The double underscore method __ is a translation helper. This helper function is wrapped from almost any object context, which means you can safely call $this->__(’My English Text’) at almost any point in your code to translate a string. The htmlEscape function simply wraps PHP’s native htmlspecialchars function, but it can also accept an array of data and escape each item individually.

September 10, 2009 at 3:20 am Leave a comment


Recent Posts

Categories

Archives

Top Posts

    Top Rated

    Blog Stats

    • 6,373 hits

     

    June 2012
    M T W T F S S
    « Sep    
     123
    45678910
    11121314151617
    18192021222324
    252627282930  

    Follow

    Get every new post delivered to your Inbox.