Javascript include_once : Laguage & Control Structures : PHP functions in JavaScript JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » PHP functions in JavaScript » Laguage & Control Structures »

 

Javascript include_once


Example 1

Running
1.include_once('http://www.phpjs.org/js/phpjs/_supporters/pj_test_supportfile_2.js');

Could return
1.true
function include_once( filename ) {
    // !No description available for include_once. @php.js developers: Please update the function summary text file.
    // 
    // version: 810.114
    // discuss at: http://phpjs.org/functions/include_once
    // +   original by: Legaev Andrey
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Michael White (http://getsprink.com)
    // -    depends on: include
    // *     example 1: include_once('http://www.phpjs.org/js/phpjs/_supporters/pj_test_supportfile_2.js');
    // *     returns 1: true
    var cur_file = {};
    cur_file[window.location.href] = 1;

    if (!window.php_js) window.php_js = {};
    if (!window.php_js.includes) window.php_js.includes = cur_file;
    if (!window.php_js.includes[filename]) {
        if(include(filename)){
            return true;
        }
    } else{
        return true;
    }
}


HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo PHP functions in JavaScript
» Laguage & Control Structures