UNPKG

phpjs

Version:

php.js offers community built php functions in javascript

74 lines (57 loc) 2.24 kB
<!-- Generated by Rakefile:build --> <strong> <a href="http://kevin.vanzonneveld.net" rel="nofollow">Kevin van Zonneveld</a> </strong> on 2008-03-16 12:49:52 <br /> @ mark forster: The site's explanation isn't too elaborate, but I think I understand the idea. It's just like Java imports, right? I can imagine it being useful for many purposes, but I don't see how we would implement it in this project for two reasons: - it requires jQuery (an additional 15kB) for only 1 functionality that - resembles Java, not php <hr /> <strong> mark forster </strong> on 2008-03-16 11:12:25 <br /> Why not check out owl import at http://code.google.com/p/owlimport/. an alternative method of importing javascript files <hr /> <strong> <a href="http://kevin.vanzonneveld.net" rel="nofollow">Kevin van Zonneveld</a> </strong> on 2008-01-08 17:24:49 <br /> @ Legaev Andrey: Wow great contributions again! At first I wanted every function to be standalone, but thinking about all the redundant code we would then get, I finally decided to add a: &amp;quot;- depends on: include&amp;quot; comment to include_once. I think we should stick to that approach. Thanks! <hr /> <strong> Legaev Andrey </strong> on 2008-01-08 16:28:53 <br /> include_once() function: <pre><code> function include_once( filename ) { if (!window.php_js) window.php_js = {}; if (!window.php_js.includes) window.php_js.includes = {}; if (!window.php_js.includes[filename]) { window.php_js.includes[filename] = 1; include_once( filename ); } } </code></pre> And small modification to include(): <pre><code> function include( filename ) { // http://kevin.vanzonneveld.net // + original by: mdsjack (http://www.mdsjack.bo.it) var js = document.createElement('script'); js.setAttribute('type', 'text/javascript'); js.setAttribute('src', filename); js.setAttribute('defer', 'defer'); document.getElementsByTagName('HEAD')[0].appendChild(js); if (!window.php_js) window.php_js = {}; if (!window.php_js.includes) window.php_js.includes = {}; if (!window.php_js.includes[filename]) window.php_js.includes[filename] = 1; else window.php_js.includes[filename]++; } </code></pre> <hr />