symfony API

JavascriptBaseHelper Functions

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

Packages

You are currently browsing the symfony API for the 1.4 version. Switch to:
This version of symfony is not maintained anymore.
If some of your projects still use this version, consider upgrading as soon as possible.

JavascriptBaseHelper.

Function Summary

Function Details

  • (string) array_or_string_for_javascript ()

    converts the given PHP array or string to the corresponding javascript array or string.

    javascript strings need to be single quoted.

    returns javascript string or array equivalent

  • (string) boolean_for_javascript ()

    converts the given PHP boolean to the corresponding javascript boolean.

    booleans need to be true or false (php would print 1 or nothing).

    returns javascript boolean equivalent

  • button_to_function ()

    Returns a button that will trigger a javascript function using the

    onclick handler and return false after the fact.

    Examples:

  • end_if_javascript ()

    Mark the end of a block that should only be shown in the browser if JavaScript

    is switched on.

  • end_javascript_tag ()

  • if_javascript ()

    Mark the start of a block that should only be shown in the browser if JavaScript

    is switched on.

  • javascript_cdata_section ()

  • javascript_tag ()

    Returns a JavaScript tag with the '$content' inside. If no content is passed, it works as the slot() method and will output everythin between

    javascript_tag() and end_javascript_tag(),
    Example:

    =>
    alert('All is good')

  • link_to_function ()

    Returns a link that will trigger a javascript function using the

    onclick handler and return false after the fact.

    Examples:

    'Really?')) ?>

  • (string) options_for_javascript ()

    converts the the PHP options array into a javscript array

    returns javascript arry equivalent