Posted: Sat Aug 25, 2007 4:52 am
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<script type="text/php">$document->body->div['id="test"']->insertElement($text);</script>Simple, I have never got into Javascript, I only know basics but even then I am lame. This is why I would love PHP syntax hehe.Everah wrote:Honestly, if what you want is Javascript to work like PHP, why not code a JS library that works like PHP?
Which is why I think it's time they dropped <script type="javascript">...</script> and just use <javascript>...</javascript>The Phoenix wrote:Because it is installed on 95% (+) of browsers, it is standard, and it enables a tremendous amount of functionality. Its tested, understood, and has been in wide use for over a decade. What makes it a terrible language in your opinion?yacahuma wrote:Why do we keep using javascript? It is a terrible language in my opinion.
I've been able to do much of the same document object model tree climbing with php's DOMDocument class that I do with prototype(js library)The Phoenix wrote: Each language is designed for something specific. PHP isn't a client side language, so couldn't do many of the things that javascript does.
Just because its ubiquitous, we should change the way you reference it, and as a result make it more backwards-incompatible for existing sites?thinsoldier wrote: Which is why I think it's time they dropped <script type="javascript">...</script> and just use <javascript>...</javascript>
They won't be removing script, because we have about a dozen other really useful (and widely deployed) scripting languages using it. Not to mention, the w3c is already eating crow over being unrealistic with Xhtml to the point that they are now working on an html5 - they aren't likely to go in that direction again.thinsoldier wrote:Now that we have prototype and similar libraries I think ECMA needs to have a look at the 2 most popular ones and start integrating all these brilliant, simple, time saving ideas into the next Javascript version and the w3c should remove <script> and add <javascript>
They could, but they aren't likely to. The key gain would be faster caching, perhaps on the order of a couple seconds for most javascript libraries. Worse, that means they are the stewards of those files. If they are broken, compromised, have a security flaw, etc - does firefox then do an update for that library when they come out? Some of the larger libraries had almost weekly updates at various points.thinsoldier wrote: ... although if the ecma doesn't do that, maybe the browser devs can impliment
<script type="javascript_lib:prototype:1.5">
<script type="javascript_lib:jquery:2.0">
etc. and make it standard practice for the browser itself to contain multiple stable versions the library files instead of having to download them over and over from site after site.
... or...
<javascript library="prototype" version="1.5">
<javascript library="yui" version="1.9">
That depends on the scripts, and what they try to do. Thats not a language issue - thats a script issue. You *can* write scripts that can all run on the same page without conflict. Many can't because of what they try to accomplish. (As an example, you can write a replacement for document.onload, and then any function can use it - but you can't have multiple scripts do so).thinsoldier wrote: and maybe someday make it possible for multiple libraries to be used in the same page without conflicting with each other?