Re: [PHP] New Help with Javascript Navigation
Yah, and why are people still mindlessly clicking OK to install ActiveX plugins? On 4/27/06, Porpoise [EMAIL PROTECTED] wrote: Gerry D [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Interesting discussions... :) I see two issues: 1. if you are exposing php scripts to the client, how does the server side processing know what it should do and what the client should see? 2. and why can't JS write to the client's file system? Or read from files? Come to my website and let me first read all your private information, then trash it... Hackers and other cyber vandals would love you to implement this feature... LOL /Gerry D Isn't that feature called ActiveX?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New Help with Javascript Navigation
Robert Cummings wrote: On Thu, 2006-04-27 at 12:36, Weber Sites LTD wrote: I know I'm going to get heat for this example So cool down, it's just an example :) Do you mean something like : http://msdn.microsoft.com/msdntv/episode.aspx?xml=episodes/en/20060119AtlasN K/manifest.xml Only for PHP? I didn't learn much: We're sorry, the page you are viewing requires a media player plug-in that is not available for this browser. Plug-ins are available for Netscape 4.7x and the latest version of Microsoft(R) Internet Explorer.Internet Explorer not that this has much to do with the thread (I think ;-) funny (as in 'not very' or 'very not') that they don't offer a mediaplayer plugin for firefox but they do offer a 'Microsoft Genuine Advantage' plugin for firefox. I found this out yesterday because I needed a javascript debugger for IE and used firefox to find/download it - which I could only do after installing the plugin. (IE seems to choak, in some instances, if you use a variable named 'parent' in your javascript as it turns out - nice) bunch of ass-munchers. Cheers, Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New Help with Javascript Navigation
Interesting discussions... :) I see two issues: 1. if you are exposing php scripts to the client, how does the server side processing know what it should do and what the client should see? 2. and why can't JS write to the client's file system? Or read from files? Come to my website and let me first read all your private information, then trash it... Hackers and other cyber vandals would love you to implement this feature... LOL Gerry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] New Help with Javascript Navigation
I know I'm going to get heat for this example So cool down, it's just an example :) Do you mean something like : http://msdn.microsoft.com/msdntv/episode.aspx?xml=episodes/en/20060119AtlasN K/manifest.xml Only for PHP? berber -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 26, 2006 11:37 PM To: php-general@lists.php.net Subject: Re: [PHP] New Help with Javascript Navigation At 01:36 PM 4/26/2006, Warren Vail wrote: PHP appears to me to be incomplete unless it can provide a way to provide client (browser) side executables in a consistent language, namely PHP. Developers get all excited about the elegence of the PHP language, and somewhere along the way they discover they have been sandbagged (they have to learn Javascipt too, if they want responsive GUI's). One solution would be to develop a PHP Plugin and support that for all the browsers out there, but another just occurred to me. What if there was a function that accepted PHP code as input and tranlated it to Javascript, returning the resulting text ready for imbedding in html? Nice idea, although sandbagged sounds like an exageration: becoming fluent in both PHP JavaScript is hardly a major life challenge. When I finally learned PHP I was delighted at how syntactically similar it was to JavaScript, compared say to the difference between JavaScript VBscript. Perhaps my most common mistake in writing in both PH JS is that I tend to use . as a concatenation operator in JavaScript these days... At 02:16 PM 4/26/2006, Evan Priestley wrote: No, I'm saying that Javascript can't read or write files on the client's machine, and that this is only one of a large number of basic limitations in the language's capabilities. It would be possible to write a script which took $a = 3 and converted it into var a = 3, but a huge number of PHP functions either can't be implemented in Javascript (file_get_contents) or are fundamentally unsafe to implement in Javascript (mysql_query), so you'd end up with a language you couldn't do anything with. To the contrary, client-side PHP would simply be a different environment from server-side PHP -- of course certain functions wouldn't apply and others would that aren't relevant to server-side PHP, but that's not rocket science. The point would be to use the same syntax in both contexts. Relevant to this discussion, there is a set of PHP DOM functions (native to the core) that look like they match with the corresponding JavaScript functions pretty closely: http://php.net/dom I haven't used them yet, but the function names look familiar. The way I might implement such a PHP-JavaScript translation might look like this: script type=text/javascript src=phpToJavaScript.php?src=myscript.php/script where phpToJavaScript.php is the translation program and myscript.php is the client-side PHP script to be translated to JavaScript. Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] New Help with Javascript Navigation
On Thu, 2006-04-27 at 12:36, Weber Sites LTD wrote: I know I'm going to get heat for this example So cool down, it's just an example :) Do you mean something like : http://msdn.microsoft.com/msdntv/episode.aspx?xml=episodes/en/20060119AtlasN K/manifest.xml Only for PHP? I didn't learn much: We're sorry, the page you are viewing requires a media player plug-in that is not available for this browser. Plug-ins are available for Netscape 4.7x and the latest version of Microsoft(R) Internet Explorer.Internet Explorer Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New Help with Javascript Navigation
Gerry D [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Interesting discussions... :) I see two issues: 1. if you are exposing php scripts to the client, how does the server side processing know what it should do and what the client should see? 2. and why can't JS write to the client's file system? Or read from files? Come to my website and let me first read all your private information, then trash it... Hackers and other cyber vandals would love you to implement this feature... LOL /Gerry D Isn't that feature called ActiveX?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] New Help with Javascript Navigation
Pub, Thank you for subscribing to and participating in the PHP users list, a place where your PHP questions can be answered. Unfortunately your last post contained several problems; a. It was to long. 2. it was a JavaScript question. Thank you, Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New Help with Javascript Navigation
Jay Blanchard wrote: Pub, Thank you for subscribing to and participating in the PHP users list, a place where your PHP questions can be answered. Unfortunately your last post contained several problems; a. It was to long. 2. it was a JavaScript question. Thank you, Jay lol - that was almost perfect... you missed an 'o' ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] New Help with Javascript Navigation
[snip] lol - that was almost perfect... you missed an 'o' ;-) [/snip] I am allowed a missed 'o' as I am on the bus (and have been for almost 24 hours) chaperoning a high school band trip to Florida. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New Help with Javascript Navigation
Pub wrote: Hello, I would really appreciate some help. Then ask a php question. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New Help with Javascript Navigation
Jay Blanchard wrote: [snip] lol - that was almost perfect... you missed an 'o' ;-) [/snip] I am allowed a missed 'o' as I am on the bus (and have been for almost 24 hours) chaperoning a high school band trip to Florida. :) This one time, at band camp, I wrote an email to the PHP-General mailing list. Doesn't quite work :( -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] New Help with Javascript Navigation
This brings up a reoccurring issue for me and I'd be interested if anyone else has given it any thought. PHP appears to me to be incomplete unless it can provide a way to provide client (browser) side executables in a consistent language, namely PHP. Developers get all excited about the elegence of the PHP language, and somewhere along the way they discover they have been sandbagged (they have to learn Javascipt too, if they want responsive GUI's). One solution would be to develop a PHP Plugin and support that for all the browsers out there, but another just occurred to me. What if there was a function that accepted PHP code as input and tranlated it to Javascript, returning the resulting text ready for imbedding in html? Any creative masochists out there? Has it already been attempted? Warren Vail -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 26, 2006 1:07 PM To: Pub; php-general@lists.php.net Subject: RE: [PHP] New Help with Javascript Navigation Pub, Thank you for subscribing to and participating in the PHP users list, a place where your PHP questions can be answered. Unfortunately your last post contained several problems; a. It was to long. 2. it was a JavaScript question. Thank you, Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New Help with Javascript Navigation
Tell you what: write file_get_contents() in Javascript, and I'll write the rest of it. Evan On Apr 26, 2006, at 4:36 PM, Warren Vail wrote: This brings up a reoccurring issue for me and I'd be interested if anyone else has given it any thought. PHP appears to me to be incomplete unless it can provide a way to provide client (browser) side executables in a consistent language, namely PHP. Developers get all excited about the elegence of the PHP language, and somewhere along the way they discover they have been sandbagged (they have to learn Javascipt too, if they want responsive GUI's). One solution would be to develop a PHP Plugin and support that for all the browsers out there, but another just occurred to me. What if there was a function that accepted PHP code as input and tranlated it to Javascript, returning the resulting text ready for imbedding in html? Any creative masochists out there? Has it already been attempted? Warren Vail -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 26, 2006 1:07 PM To: Pub; php-general@lists.php.net Subject: RE: [PHP] New Help with Javascript Navigation Pub, Thank you for subscribing to and participating in the PHP users list, a place where your PHP questions can be answered. Unfortunately your last post contained several problems; a. It was to long. 2. it was a JavaScript question. Thank you, Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New Help with Javascript Navigation
On Wed, 2006-04-26 at 16:47, Evan Priestley wrote: Tell you what: write file_get_contents() in Javascript, and I'll write the rest of it. I hope you're not going to welch!! ?php NOT; function file_get_contents( path ) { return ijinn_getContent( path ); } function ijinn_getContent( path ) { var content = false; path = ijinn_localizePath( path ); if( navigator.appName == 'Microsoft Internet Explorer' ) { httpRequest = new ActiveXObject( 'Microsoft.XMLHTTP' ); } else { httpRequest = new XMLHttpRequest(); } httpRequest.open( 'get', path, false ); httpRequest.send( null ); if( httpRequest.status == 200 ) { content = httpRequest.responseText; } return content; } ? Unfortunately, you're going to have a HELL of a time with dynamically include()'ing source :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] New Help with Javascript Navigation
Evan, Are you proposing something like AJAX does? My understanding is limited here, so bear with me. A control like a hidden imbedded frame (IFRAME) is acted upon by Javascript to cause it to dynamically request loading a page into the frame, and when loaded, the javascript processes the contents of the frame without necessarily displaying it directly? And then do the translation on the client? Could work, but I was thinking more of doing the tranlation in a function in PHP, but that may be because PHP is my perspective. Something like; --- snip -- Html stuff ?php echo scripttranslate( Php code follows here Careful with quotes); ? More html stuff --- snip -- Or --- snip -- Echo html stuff here .scripttranslate(php stuff here... . again carefull with quotes) .more html stuff here); // end of echo statement --- snip -- Warren -Original Message- From: Evan Priestley [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 26, 2006 1:47 PM To: Warren Vail Cc: PHP General List Subject: Re: [PHP] New Help with Javascript Navigation Tell you what: write file_get_contents() in Javascript, and I'll write the rest of it. Evan On Apr 26, 2006, at 4:36 PM, Warren Vail wrote: This brings up a reoccurring issue for me and I'd be interested if anyone else has given it any thought. PHP appears to me to be incomplete unless it can provide a way to provide client (browser) side executables in a consistent language, namely PHP. Developers get all excited about the elegence of the PHP language, and somewhere along the way they discover they have been sandbagged (they have to learn Javascipt too, if they want responsive GUI's). One solution would be to develop a PHP Plugin and support that for all the browsers out there, but another just occurred to me. What if there was a function that accepted PHP code as input and tranlated it to Javascript, returning the resulting text ready for imbedding in html? Any creative masochists out there? Has it already been attempted? Warren Vail -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 26, 2006 1:07 PM To: Pub; php-general@lists.php.net Subject: RE: [PHP] New Help with Javascript Navigation Pub, Thank you for subscribing to and participating in the PHP users list, a place where your PHP questions can be answered. Unfortunately your last post contained several problems; a. It was to long. 2. it was a JavaScript question. Thank you, Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] New Help with Javascript Navigation
On Wed, April 26, 2006 3:36 pm, Warren Vail wrote: One solution would be to develop a PHP Plugin and support that for all the http://pecl.php.net/package/PHPScript Just stumbled across it the other day, and it's on my check it out list... Reviews from those more knowlegable most welcome. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New Help with Javascript Navigation
No, I'm saying that Javascript can't read or write files on the client's machine, and that this is only one of a large number of basic limitations in the language's capabilities. It would be possible to write a script which took $a = 3 and converted it into var a = 3, but a huge number of PHP functions either can't be implemented in Javascript (file_get_contents) or are fundamentally unsafe to implement in Javascript (mysql_query), so you'd end up with a language you couldn't do anything with. Evan On Apr 26, 2006, at 5:07 PM, Warren Vail wrote: Evan, Are you proposing something like AJAX does? My understanding is limited here, so bear with me. A control like a hidden imbedded frame (IFRAME) is acted upon by Javascript to cause it to dynamically request loading a page into the frame, and when loaded, the javascript processes the contents of the frame without necessarily displaying it directly? And then do the translation on the client? Could work, but I was thinking more of doing the tranlation in a function in PHP, but that may be because PHP is my perspective. Something like; --- snip -- Html stuff ?php echo scripttranslate( Php code follows here Careful with quotes); ? More html stuff --- snip -- Or --- snip -- Echo html stuff here .scripttranslate(php stuff here... . again carefull with quotes) .more html stuff here); // end of echo statement --- snip -- Warren -Original Message- From: Evan Priestley [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 26, 2006 1:47 PM To: Warren Vail Cc: PHP General List Subject: Re: [PHP] New Help with Javascript Navigation Tell you what: write file_get_contents() in Javascript, and I'll write the rest of it. Evan On Apr 26, 2006, at 4:36 PM, Warren Vail wrote: This brings up a reoccurring issue for me and I'd be interested if anyone else has given it any thought. PHP appears to me to be incomplete unless it can provide a way to provide client (browser) side executables in a consistent language, namely PHP. Developers get all excited about the elegence of the PHP language, and somewhere along the way they discover they have been sandbagged (they have to learn Javascipt too, if they want responsive GUI's). One solution would be to develop a PHP Plugin and support that for all the browsers out there, but another just occurred to me. What if there was a function that accepted PHP code as input and tranlated it to Javascript, returning the resulting text ready for imbedding in html? Any creative masochists out there? Has it already been attempted? Warren Vail -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 26, 2006 1:07 PM To: Pub; php-general@lists.php.net Subject: RE: [PHP] New Help with Javascript Navigation Pub, Thank you for subscribing to and participating in the PHP users list, a place where your PHP questions can be answered. Unfortunately your last post contained several problems; a. It was to long. 2. it was a JavaScript question. Thank you, Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New Help with Javascript Navigation
BTW Wez Furlong has written an ActiveScript compatible plugin that allows running php clientside in the browser - YMWV. /BTW Robert Cummings wrote: On Wed, 2006-04-26 at 16:47, Evan Priestley wrote: ... nice func Rob. :-) now onward to HELL ... ? Unfortunately, you're going to have a HELL of a time with dynamically include()'ing source :) function includeJS(jsPath) { // bogus URL/path to script? if (!isString(jsPath) || !jsPath) { return; } // remove extraneous spaces - just in case jsPath = jsPath.trim(); // has the given script already been 'included'? var scripts = document.getElementsByTagName(SCRIPT); var scriptsLen = scripts.length; for (var i = 0; i scriptsLen; i++) { if (scripts.src == jsPath) { // the requested file has already been added (or was defined/linked from the start. return; } } // everything is ok, lets include the script. var script = document.createElement(SCRIPT); script.setAttribute(type, text/javascript); script.setAttribute(src, jsPath); document.getElementsByTagName(HEAD)[0].appendChild( script ); } probably far from perfect but it's helped me out of a jam now and again. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New Help with Javascript Navigation
On Wed, 2006-04-26 at 17:18, Jochem Maas wrote: BTW Wez Furlong has written an ActiveScript compatible plugin that allows running php clientside in the browser - YMWV. /BTW Robert Cummings wrote: On Wed, 2006-04-26 at 16:47, Evan Priestley wrote: ... nice func Rob. :-) now onward to HELL ... ? Unfortunately, you're going to have a HELL of a time with dynamically include()'ing source :) function includeJS(jsPath) { // bogus URL/path to script? if (!isString(jsPath) || !jsPath) { return; } // remove extraneous spaces - just in case jsPath = jsPath.trim(); // has the given script already been 'included'? var scripts = document.getElementsByTagName(SCRIPT); var scriptsLen = scripts.length; for (var i = 0; i scriptsLen; i++) { if (scripts.src == jsPath) { // the requested file has already been added (or was defined/linked from the start. return; } } // everything is ok, lets include the script. var script = document.createElement(SCRIPT); script.setAttribute(type, text/javascript); script.setAttribute(src, jsPath); document.getElementsByTagName(HEAD)[0].appendChild( script ); } probably far from perfect but it's helped me out of a jam now and again. Been there, done that technique... unfortunately it can't be used to dynamically load script that will be seen by the currently executing scope... this isn't quite true... I think one browser saw it right off, another saw it if I used eval on the retrieved source, but other browsers don't see it until after the scope (function scope) exits. The exact semantics are quite varying which provides for completely unreliable loading of dyanamic script -- and to be frank I try to make my stuff work with IE/FF/Opera. I could care less about NN4 in this day and age :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New Help with Javascript Navigation
At 01:36 PM 4/26/2006, Warren Vail wrote: PHP appears to me to be incomplete unless it can provide a way to provide client (browser) side executables in a consistent language, namely PHP. Developers get all excited about the elegence of the PHP language, and somewhere along the way they discover they have been sandbagged (they have to learn Javascipt too, if they want responsive GUI's). One solution would be to develop a PHP Plugin and support that for all the browsers out there, but another just occurred to me. What if there was a function that accepted PHP code as input and tranlated it to Javascript, returning the resulting text ready for imbedding in html? Nice idea, although sandbagged sounds like an exageration: becoming fluent in both PHP JavaScript is hardly a major life challenge. When I finally learned PHP I was delighted at how syntactically similar it was to JavaScript, compared say to the difference between JavaScript VBscript. Perhaps my most common mistake in writing in both PH JS is that I tend to use . as a concatenation operator in JavaScript these days... At 02:16 PM 4/26/2006, Evan Priestley wrote: No, I'm saying that Javascript can't read or write files on the client's machine, and that this is only one of a large number of basic limitations in the language's capabilities. It would be possible to write a script which took $a = 3 and converted it into var a = 3, but a huge number of PHP functions either can't be implemented in Javascript (file_get_contents) or are fundamentally unsafe to implement in Javascript (mysql_query), so you'd end up with a language you couldn't do anything with. To the contrary, client-side PHP would simply be a different environment from server-side PHP -- of course certain functions wouldn't apply and others would that aren't relevant to server-side PHP, but that's not rocket science. The point would be to use the same syntax in both contexts. Relevant to this discussion, there is a set of PHP DOM functions (native to the core) that look like they match with the corresponding JavaScript functions pretty closely: http://php.net/dom I haven't used them yet, but the function names look familiar. The way I might implement such a PHP-JavaScript translation might look like this: script type=text/javascript src=phpToJavaScript.php?src=myscript.php/script where phpToJavaScript.php is the translation program and myscript.php is the client-side PHP script to be translated to JavaScript. Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] New Help with Javascript Navigation
You are absolutely correct, that anything that ran on the client machine would have to be safe and not venture outside the sandbox, but that is not what I had in mind, and I don't think that was the goal of PUB? Who began this thread. I believe he wanted to manage some responses to mouseover, and was sent to another list to find his answer. You are right on again with the understanding that much of the power and elegance of PHP would not be available for this type of coding, but there still is a need and a reason people are forced to turn to Javascript (which is also limited to the sandbox), starting with simple interactive data validation, and moving right on up to managing images, or changing control behaviors and such. I just think it would be nice to be able to do it all in PHP, it's such a graceful language to work with. Meanwhile, I think I'll check out PHPScript, that Richard Lynch found, as soon as I can. Warren Vail -Original Message- From: Evan Priestley [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 26, 2006 2:16 PM To: Warren Vail Cc: 'PHP General List' Subject: Re: [PHP] New Help with Javascript Navigation No, I'm saying that Javascript can't read or write files on the client's machine, and that this is only one of a large number of basic limitations in the language's capabilities. It would be possible to write a script which took $a = 3 and converted it into var a = 3, but a huge number of PHP functions either can't be implemented in Javascript (file_get_contents) or are fundamentally unsafe to implement in Javascript (mysql_query), so you'd end up with a language you couldn't do anything with. Evan On Apr 26, 2006, at 5:07 PM, Warren Vail wrote: Evan, Are you proposing something like AJAX does? My understanding is limited here, so bear with me. A control like a hidden imbedded frame (IFRAME) is acted upon by Javascript to cause it to dynamically request loading a page into the frame, and when loaded, the javascript processes the contents of the frame without necessarily displaying it directly? And then do the translation on the client? Could work, but I was thinking more of doing the tranlation in a function in PHP, but that may be because PHP is my perspective. Something like; --- snip -- Html stuff ?php echo scripttranslate( Php code follows here Careful with quotes); ? More html stuff --- snip -- Or --- snip -- Echo html stuff here .scripttranslate(php stuff here... . again carefull with quotes) .more html stuff here); // end of echo statement --- snip -- Warren -Original Message- From: Evan Priestley [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 26, 2006 1:47 PM To: Warren Vail Cc: PHP General List Subject: Re: [PHP] New Help with Javascript Navigation Tell you what: write file_get_contents() in Javascript, and I'll write the rest of it. Evan On Apr 26, 2006, at 4:36 PM, Warren Vail wrote: This brings up a reoccurring issue for me and I'd be interested if anyone else has given it any thought. PHP appears to me to be incomplete unless it can provide a way to provide client (browser) side executables in a consistent language, namely PHP. Developers get all excited about the elegence of the PHP language, and somewhere along the way they discover they have been sandbagged (they have to learn Javascipt too, if they want responsive GUI's). One solution would be to develop a PHP Plugin and support that for all the browsers out there, but another just occurred to me. What if there was a function that accepted PHP code as input and tranlated it to Javascript, returning the resulting text ready for imbedding in html? Any creative masochists out there? Has it already been attempted? Warren Vail -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 26, 2006 1:07 PM To: Pub; php-general@lists.php.net Subject: RE: [PHP] New Help with Javascript Navigation Pub, Thank you for subscribing to and participating in the PHP users list, a place where your PHP questions can be answered. Unfortunately your last post contained several problems; a. It was to long. 2. it was a JavaScript question. Thank you, Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] New Help with Javascript Navigation
Sounds like you may be a young dude ;-) You know what they say about us old dogs and new tricks. PHP was a wonderful new trick for me, but javascript still stretches me a bit much, and if it weren't for the similarities you mention, I'd be completely lost. I think the reason we keep getting questions about Javascript on this list, is because others are struggling with it as I am. It would be nice if it were covered by PHP. Just think how it would be if you could write PHP that could access the browser object model and alter settings on the clients screen dynamically, of course, at some stage it would be necessary to implement a means of communicating back to the server, but just to be able to provide interaction on the client machine would be a great start. Warren Vail -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 26, 2006 2:37 PM To: php-general@lists.php.net Subject: Re: [PHP] New Help with Javascript Navigation At 01:36 PM 4/26/2006, Warren Vail wrote: PHP appears to me to be incomplete unless it can provide a way to provide client (browser) side executables in a consistent language, namely PHP. Developers get all excited about the elegence of the PHP language, and somewhere along the way they discover they have been sandbagged (they have to learn Javascipt too, if they want responsive GUI's). One solution would be to develop a PHP Plugin and support that for all the browsers out there, but another just occurred to me. What if there was a function that accepted PHP code as input and tranlated it to Javascript, returning the resulting text ready for imbedding in html? Nice idea, although sandbagged sounds like an exageration: becoming fluent in both PHP JavaScript is hardly a major life challenge. When I finally learned PHP I was delighted at how syntactically similar it was to JavaScript, compared say to the difference between JavaScript VBscript. Perhaps my most common mistake in writing in both PH JS is that I tend to use . as a concatenation operator in JavaScript these days... At 02:16 PM 4/26/2006, Evan Priestley wrote: No, I'm saying that Javascript can't read or write files on the client's machine, and that this is only one of a large number of basic limitations in the language's capabilities. It would be possible to write a script which took $a = 3 and converted it into var a = 3, but a huge number of PHP functions either can't be implemented in Javascript (file_get_contents) or are fundamentally unsafe to implement in Javascript (mysql_query), so you'd end up with a language you couldn't do anything with. To the contrary, client-side PHP would simply be a different environment from server-side PHP -- of course certain functions wouldn't apply and others would that aren't relevant to server-side PHP, but that's not rocket science. The point would be to use the same syntax in both contexts. Relevant to this discussion, there is a set of PHP DOM functions (native to the core) that look like they match with the corresponding JavaScript functions pretty closely: http://php.net/dom I haven't used them yet, but the function names look familiar. The way I might implement such a PHP-JavaScript translation might look like this: script type=text/javascript src=phpToJavaScript.php?src=myscript.php/script where phpToJavaScript.php is the translation program and myscript.php is the client-side PHP script to be translated to JavaScript. Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php