[Phpmyadmin-devel] inline js

Marc Delisle marc at infomarc.info
Sat Mar 27 21:12:37 CET 2010


Michal Čihař a écrit :
> Hi
> 
> Dne Fri, 26 Mar 2010 08:01:31 -0400
> Marc Delisle <marc at infomarc.info> napsal(a):
> 
>> how do you propose to handle the case when a condition in PHP triggers 
>> some document.write calls that add a functionality only available with 
>> js, like the color picker? See main.php in master.
> 
> In this case you can append to #li_select_theme in case it exists.
> Usually there is simple way to write condition in javascript [*] and it
> makes things much simpler (it avoids mixing up different
> languages in single file, what tends to be confusing).
> 
> The best reason for this is to separate used languages in separate
> files. With PHP you're already mixing up HTML and PHP what we would
> like to avoid through using templates. Adding JavaScript into this
> mixture just makes the code more confusing and harder to read.
> 
> [*] I'm quit customized to mootools so I can not provide example for
> jQuery, but I doubt it is hard.

There are other places like in tbl_select.php where a PHP loop generates
some js. Maybe it could be done via our js_include mechanism and
renaming in .js.php but I'm not sure. Even if it works, I'm not sure
about the caching.


-- 
Marc Delisle
http://infomarc.info




More information about the Developers mailing list