Javascript.RU

PHP-функция: include_once

Зависит от

Javascript:

function include_once( filename ) {	// The include_once() statement includes and evaluates the specified file during
	// the execution of the script. This is a behavior similar to the include()
	// statement, with the only difference being that if the code from a file has
	// already been included, it will not be included again.  As the name suggests, it
	// will be included just once.
	// 
	// +   original by: Legaev Andrey
	// +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
	// +   improved by: Michael White (http://crestidg.com)

	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]) {
		return this.include(filename);
	} else{
		return window.php_js.includes[filename];
	}
}

Примеры:

include_once('/js/imaginary2.js');
1


 
Поиск по сайту
Содержание

Учебник javascript

Основные элементы языка

Сундучок с инструментами

Интерфейсы

Все об AJAX

Оптимизация

Разное

Дерево всех статей

Последние темы на форуме
Forum