Can I use a script to check if a JS file is loaded?
I have a function, which places a form on a page with javascript controls. I don\'t know where the user will use th
You should have an asset management system in your PHP to see whats being included into the page.
Ultra simple example (derived from link):
';
}
static function render_content() {
echo self::$content;
}
static function read_content($file) {
ob_start();
require $file;
self::$content = ob_get_clean();
}
static function render_layout($file) {
require $file;
}
static function add_js($js) {
if (!in_array($js, self::$js_assets)) {
self::$js_assets[] = $js;
}
}
}
Page::add_js('/javascripts/application.js');
Page::read_content('view.php');
Page::render_layout('layout.php');
?>
layout.php:
view.php:
Hello World!'); ?>
Hello
World