[PHP] HTTP_WebDAV_Server problems
Hello All I'm trying to get a WebDAV server set up using PEAR::HTTP_WebDAV_Server, but so far I'm having little success. All I could get from the 11 Slides was that the Class had to be subclassed, and the methods overloaded, to provide the functionality. I gathered from the source-code, that I had to instigate the object, and call the ServeRequest method - This works OK for GET requests via the Browser, but when I try it in MSWord or OOo, it opens whatever it marked read only, as opposed to read/write. I've written the following so far in an attempt to help me understand the procedure. Any suggestions? #!/usr/local/php51/bin/php ServeRequest();
[PHP] call a javascript within php
How can I call a JavaScript inside php? Thängs -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] call a javascript within php
[snip] How can I call a JavaScript inside php? [/snip] Echo it out. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] call a javascript within php
At 09:59 AM 7/30/2006, Jochen Kaechelin wrote: How can I call a JavaScript inside php? You can't literally call client-side JavaScript from server-side PHP because they're executing at different times and in different computers. PHP executes on the server then downloads the page to the browser, then JavaScript executes in the browser. What you can do is to write your PHP script so that it generates your JavaScript code as part of the page download, set to execute automatically when the page downloads. The JavaScript can either be inline in the HTML page itself or linked to the HTML page with a script tag and a SRC attribute that produces the desired JavaScript on the fly, e.g.: echo <<< hdJS type="text/javascript"> hdJS; If your JavaScript is static -- already written, not needing modification -- you can simply link it to your PHP-generated HTML page as usual: echo <<< hdJS hdJS; Another variation involves a static JS script that's fed dynamically-generated variables by PHP. This isn't a shared variable space between the two languages but more like a communication channel between them: $frog = 'Hello'; $dog = 'world'; echo <<< hdJS var frog = "$frog"; var dog = "$dog"; hdJS; Of course you can generate entire blocks of JavaScript logic with PHP if need be, but I would suspect that in most cases you'd be better off feeding a few key variables to a static JS script. _ Most of the time you'll want your JS script to execute after the HTML finishes downloading, so that JavaScript will be able to find all the page elements in the DOM. Three ways of doing this are: 1) Use the window.onload method in a linked JavaScript script: window.onload = jsFunctionName; function jsFunctionName() { ... } Notice the lack of parentheses in the onload statement. This is because you want to set window.onload equal to the content of the function, not execute the function as would occur if you wrote "window.onload = jsFunctionName();". The window.onload statement wipes out any pre-existing onload function. Multiple linked scripts can use this method cooperatively this way: // save any pre-existing onload function var uniqueVariableName = window.onload; // do the following when the page finishes downloading: window.onload = function() { // if there was a pre-existing onload function, run it now if (uniqueVariableName) uniqueVariableName(); // run the function jsFunctionName(); } // here's the function you want to execute when the page has loaded function jsFunctionName() { ... } In this example, "uniqueVariableName" is different for each script that uses it. I usually use the name of the JavaScript file as part of this variable name to ensure uniqueness. Multiple onloads can also be implemented using the addEventListener method: http://developer.mozilla.org/en/docs/DOM:element.addEventListener 2) Use the onLoad attribute in the body tag: ...where jsFunctionName() is a function in a linked or inline script. I don't recommend this method because it mixes HTML with scripting more than is necessary. The more separate you keep them, the easier both will be to maintain. 3) Insert the function call in a script statement at the bottom of the HTML markup: ... jsFunctionName(); Same argument against mixing HTML with scripting, although one could argue that this constitutes the same degree of mixing that occurs with the
RE: [PHP] Saving a dynamic file
Depends on what you are planning to do with the file. Saving it to PDF is also possible, take a look at http://fpdf.org and http://htmldoc.org/. Brady -Original Message- Hi!! I'm in the need of saving to a file a dynamic page that I generated from a PHP script, taking data from a table!! So far I have figured out two options: 1) Save the page as a XML document so it can be editable in a word processor later. Do I have to write line by line until I'm done with the document? 2) Use a class to convert & save the dynamic page into a Word document. Is there any other options available?? Regards MIGUEL GUIRAO AGUILERA Logistica R8 - Telcel Tel: (999) 960.7994 Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta dirigido; contiene informacion estrictamente confidencial y legalmente protegida, cuya divulgacion es sancionada por la ley. Si el lector de este mensaje no es a quien esta dirigido, ni se trata del empleado o agente responsable de esta informacion, se le notifica por medio del presente, que su reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio este comunicado por error, favor de notificarlo inmediatamente al remitente y destruir el mensaje. Todas las opiniones contenidas en este mail son propias del autor del mensaje y no necesariamente coinciden con las de Radiomovil Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos. This message is for the sole use of the person or entity to whom it is being sent. Therefore, it contains strictly confidential and legally protected material whose disclosure is subject to penalty by law. If the person reading this message is not the one to whom it is being sent and/or is not an employee or the responsible agent for this information, this person is herein notified that any unauthorized dissemination, distribution or copying of the materials included in this facsimile is strictly prohibited. If you received this document by mistake please notify immediately to the subscriber and destroy the message. Any opinions contained in this e-mail are those of the author of the message and do not necessarily coincide with those of Radiomovil Dipsa, S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries companies. No part of this message or attachments may be used or reproduced in any manner whatsoever. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PAYPAL TRANSACTION.
BBC wrote: Hi list.. Please any one point me to the web which talk about making transaction with paypal step by step. Some body offered me the source code and tutorial but until know he or she didn't send me. http://www.paypal.com I'm sure someone here has used / set up paypal but they provide complete instructions on everything you need to do. If you have any problems, that's what their support team is for. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mb_substr()
tedd wrote: Hi gang: From another list, a person posted: "I want to use PHP's mb_substr() function to grab the first letter of a UTF-8 encoded word (in Czech) being pulled out of MySQL. If I use the plain substr() the data gets garbled and I get a ? symbol in the browser. My host says that in order to get multibyte string functions I'd have to compile my own copy of PHP. That's getting a little deeper than I want to for one function on one page. Does anyone know what I could do as a workaround?" I've tried to help, but it appears beyond me. Anyone have any advice I could pass on? "Out of luck". mb_substr handles multibyte character sets, substr doesn't. Same as the rest of the multibyte functions. (Kinda like asking "I want to use all some of the GD functions but I don't have GD - what can I do").. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sorting in array
Hi all , I have array value as shown below, i have paste my test php code below: I have problem when doing usort() when 'country' = '', i would like to display records where country = '' last. Any ideas how to do that ? Thanks $arraytest= array( array ( 'country' => '', ) , array ( 'country' => 'Thailand', ) , array ( 'country' => 'Singapore', ) , array ( 'country' => 'Singapore', ) , array ( 'country' => '', ) , array ( 'country' => '', ) , array ( 'country' => '', ) ); function cmpcountry($a, $b) { $country1 = $a['country']; $country2 = $b['country']; return ($country1 < $country2) ? -1 : 1; } usort($arraytest,"cmpcountry"); while(list($name,$value)=each($arraytest)){ echo $name.""; while(list($n,$v) = each($arraytest[$name])){ echo $v.""; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] sorting in array
function cmpcountry($a, $b) { $country1 = $a['country']; $country2 = $b['country']; if($country1=='') return 1; else return ($country1 < $country2) ? -1 : 1; } -Original Message- From: weetat [mailto:[EMAIL PROTECTED] Sent: Monday, July 31, 2006 12:32 PM To: php-general@lists.php.net Subject: [PHP] sorting in array Hi all , I have array value as shown below, i have paste my test php code below: I have problem when doing usort() when 'country' = '', i would like to display records where country = '' last. Any ideas how to do that ? Thanks $arraytest= array( array ( 'country' => '', ) , array ( 'country' => 'Thailand', ) , array ( 'country' => 'Singapore', ) , array ( 'country' => 'Singapore', ) , array ( 'country' => '', ) , array ( 'country' => '', ) , array ( 'country' => '', ) ); function cmpcountry($a, $b) { $country1 = $a['country']; $country2 = $b['country']; return ($country1 < $country2) ? -1 : 1; } usort($arraytest,"cmpcountry"); while(list($name,$value)=each($arraytest)){ echo $name.""; while(list($n,$v) = each($arraytest[$name])){ echo $v.""; } } -- 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] sorting in array
Hi , Doesn't work . Any ideas ? Thanks Peter Lauri wrote: function cmpcountry($a, $b) { $country1 = $a['country']; $country2 = $b['country']; if($country1=='') return 1; else return ($country1 < $country2) ? -1 : 1; } -Original Message- From: weetat [mailto:[EMAIL PROTECTED] Sent: Monday, July 31, 2006 12:32 PM To: php-general@lists.php.net Subject: [PHP] sorting in array Hi all , I have array value as shown below, i have paste my test php code below: I have problem when doing usort() when 'country' = '', i would like to display records where country = '' last. Any ideas how to do that ? Thanks $arraytest= array( array ( 'country' => '', ) , array ( 'country' => 'Thailand', ) , array ( 'country' => 'Singapore', ) , array ( 'country' => 'Singapore', ) , array ( 'country' => '', ) , array ( 'country' => '', ) , array ( 'country' => '', ) ); function cmpcountry($a, $b) { $country1 = $a['country']; $country2 = $b['country']; return ($country1 < $country2) ? -1 : 1; } usort($arraytest,"cmpcountry"); while(list($name,$value)=each($arraytest)){ echo $name.""; while(list($n,$v) = each($arraytest[$name])){ echo $v.""; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sorting in array
At 10:31 PM 7/30/2006, weetat wrote: I have problem when doing usort() when 'country' = '', i would like to display records where country = '' last. Any ideas how to do that ? ... $arraytest= array( array ( 'country' => '', ) , array ( 'country' => 'Thailand', ) ... function cmpcountry($a, $b) { $country1 = $a['country']; $country2 = $b['country']; return ($country1 < $country2) ? -1 : 1; } Weetat, You can sort the blank fields to the end simply by forcing their evaluated values in your usort callback function: function cmpcountry($a, $b) { $country1 = $a['country']; $country2 = $b['country']; if ($country1 == '') $country1 = "zzz"; if ($country2 == '') $country2 = "zzz"; return ($country1 < $country2) ? -1 : 1; } ...or, using ternary syntax: function cmpcountry($a, $b) { $country1 = ($a['country'] == '') ? "zzz" : $a['country']; $country2 = ($b['country'] == '') ? "zzz" : $b['country']; return ($country1 < $country2) ? -1 : 1; } Regards, Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php