Quick actions

cmd+k|ctrl+k

Navigation

Languages

Leaving JS to end with Array() in PHP

Snippet info

Language

Php

Visibility

public

Author

mertskaplan

Created

2016-12-28T13:10:51Z

Updated

2018-08-23T16:26:47Z

<?php
$scripts = array();

/* add script */
$script = <<<JS
    $(function () {
        $('input').iCheck({
            checkboxClass: 'icheckbox_square-blue',
            radioClass: 'iradio_square-blue',
            increaseArea: '20%' // optional
        });
    });
JS;
array_push($scripts, $script);

/* add script */
$script = <<<JS
    $(function () {
       $("#updateAccount").html('<i class="fa fa-refresh margin-r-5 fa-spin"></i> Updating');
    });
JS;
array_push($scripts, $script);

/* function */
function scripts() {
    global $scripts;
    if (isset($scripts[0])) {
        echo "\n".'<script type="text/javascript">';
        foreach ($scripts as $script) {
            echo "\n".$script;
        }
        echo "\n".'</script>'."\n";
    }
}

/* using */
scripts();
INFO