-
(string) array_or_string_for_javascript ((option) $option)
Browse code
| $option |
(typically from option array)
|
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 ($bool)
Browse code
| $bool |
(typically from option array)
|
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 ($name, $function, $html_options = array())
Browse code
| $name |
|
| $function |
|
| $html_options |
|
Returns a button that'll trigger a javascript function using the
onclick handler and return false after the fact.
Examples: <?php echo button_to_function('Greeting', "alert('Hello world!')") ?>
-
Mark the end of a block that should only be shown in the browser if
JavaScript is switched on.
-
-
Mark the start of a block that should only be shown in the browser if
JavaScript is switched on.
-
javascript_cdata_section ($content)
Browse code
-
javascript_tag ($content = null)
Browse code
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: <?php echo javascript_tag("alert('All is good')") ?> => <script type="text/javascript">alert('All is good')</script> <?php javascript_tag() ?>alert('All is good')<?php end_javascript_tag() ?>
-
link_to_function ($name, $function, $html_options = array())
Browse code
| $name |
|
| $function |
|
| $html_options |
|
Returns a link that'll trigger a javascript function using the
onclick handler and return false after the fact.
Examples: <?php echo link_to_function('Greeting', "alert('Hello world!')") ?> <?php echo link_to_function(image_tag('delete'), "do_delete()", array('confirm' => 'Really?')) ?>
-
(string) options_for_javascript ($options)
Browse code
converts the the PHP options array into a javscript array
returns javascript arry equivalent