[PHP] Newbie form question
Hello. I have an application that generete HTML5 form in PHP. The form is written in a while loop and therefore the form field has exact same name for every row in the loop. And that is the problem. Because when my PHP document shall handle submitted data it only take the very last row in the while loop and show the result of it. if(isset($_POST['update_explosive'])){ $item_serial_number = $_POST['item_serial_number']; $update_item_in_store = $_POST['update_item_in_store']; if($item_serial_number === ETX1.22X1000){ echo h1$update_item_in_store/h1; } if($item_serial_number === ETX1.17X460){ echo h1$update_item_in_store/h1; } } I think the solution will be to create different and unike fieldname dymamic. For example I tried to write input type=text name=?php echo $item_serial_number; ? value=?php echo $item_serial_number; ? in the HTML5/PHP form. But the problem is that periode . not is allowed as $variable_name. I then try to write it this way: if(isset($_POST['update_explosive'])){ $item_serial_number = $_POST['ETX1.22X1000']; $update_item_in_store = $_POST['update_item_in_store']; if($item_serial_number === ETX1.22X1000){ echo h1$update_item_in_store/h1; } if($item_serial_number === ETX1.17X460){ echo h1$update_item_in_store/h1; } } But this last part did not make any sense to me. I recive no output when tried that one. One problem is that I have between 2 and 25 items with different serial number. Sometimes only 5 of this shall be updated and other times all 25 items. I like to do this through one simple form and not for one time for every single item. (I know how to do when select one by one and update them, but that is a long and hard way for people using my application. A better solution is to just use one form and view all items there. Then just write the amount of item in input type=number name=update_item_in_store size=6 field.) If you have time to help me *understand* this newbie question by explain or give me an example or post a link to a tutorial that can help me though, I am very thankful. Karl
Re: [PHP] newbie PDO query display question
On Sun, Jun 16, 2013 at 6:29 PM, dealTek deal...@gmail.com wrote: Hi all, newbie PDO question... I think (hard to tell - buried in a wrapper class) I am doing a select query using - PDO::FETCH_ASSOC like... wrapper -- return $pdostmt-fetchAll(PDO::FETCH_ASSOC); --- so my query is like... $results = $db-select(mytable, id = 201); //just 1 exact record) then I can loop like.. foreach ($results as $result) { ? tr td?php echo $result[First]; ?/td td?php echo $result[Last]; ?/td td?php echo $result[id]; ?/td /tr This all works fine. --- But since I only have 1 exact record - I don't need to LOOP anything - so... Q: How do I display the columns without a loop these fail - so what will work echo $results[First]; echo $results[First][0]; ??? echo $results[First][1]; ??? PDO::fetchAll returns its data as an array, even if only one record is returned. In this case, echo $results[0][First]; echo $results[0][Last]; echo $results[0][id]; will do what you want. snip
[PHP] newbie PDO query display question
Hi all, newbie PDO question... I think (hard to tell - buried in a wrapper class) I am doing a select query using - PDO::FETCH_ASSOC like... wrapper -- return $pdostmt-fetchAll(PDO::FETCH_ASSOC); --- so my query is like... $results = $db-select(mytable, id = 201); //just 1 exact record) then I can loop like.. foreach ($results as $result) { ? tr td?php echo $result[First]; ?/td td?php echo $result[Last]; ?/td td?php echo $result[id]; ?/td /tr This all works fine. --- But since I only have 1 exact record - I don't need to LOOP anything - so... Q: How do I display the columns without a loop these fail - so what will work echo $results[First]; echo $results[First][0]; ??? echo $results[First][1]; ??? -- Thanks, Dave r...@musenet.com [db-3] -- Thanks, Dave - DealTek deal...@gmail.com [db-3]
Re: [PHP] newbie PDO query display question
On Jun 16, 2013, at 3:37 PM, Stephen stephe...@rogers.com wrote: Here is a sample from my code: $photo_category_list = ; $SQL = SELECT category_id, category_name FROM gallery_category ORDER by category_order; try { $stmt = $dbh-prepare($SQL); $stmt-execute(); while ( list( $id, $name) = $stmt-fetch(PDO::FETCH_NUM)) { $photo_category_list .= option value=$id$name/option\n; } } catch (PDOException $e){ echo 'Error getting category name. ' . $e-getMessage(); } return $photo_category_list; Try to avoid your code assuming that you will just get one record back (unless you use Limit 1) Thanks Stephen, Nice code! you mentioned ... - to avoid your code assuming that you will just get one record back But what about the case where you are deliberately just showing one record as in FIND ONE PERSON like where ID = 101 ? do you still need to loop through when you just selected/displayed 1 ITEM? Q: How do I display the columns without a loop in this 1 record case...? these fail - so what will work? echo $results[First]; echo $results[First][0]; ??? echo $results[First][1]; ??? While works better than foreach for getting the result rows from PDO -- Thanks, Dave - DealTek deal...@gmail.com [db-3]
Re: [PHP] newbie PDO query display question
dealTek deal...@gmail.com wrote: On Jun 16, 2013, at 3:37 PM, Stephen stephe...@rogers.com wrote: Here is a sample from my code: $photo_category_list = ; $SQL = SELECT category_id, category_name FROM gallery_category ORDER by category_order; try { $stmt = $dbh-prepare($SQL); $stmt-execute(); while ( list( $id, $name) = $stmt-fetch(PDO::FETCH_NUM)) { $photo_category_list .= option value=$id$name/option\n; } } catch (PDOException $e){ echo 'Error getting category name. ' . $e-getMessage(); } return $photo_category_list; Try to avoid your code assuming that you will just get one record back (unless you use Limit 1) Thanks Stephen, Nice code! you mentioned ... - to avoid your code assuming that you will just get one record back But what about the case where you are deliberately just showing one record as in FIND ONE PERSON like where ID = 101 ? do you still need to loop through when you just selected/displayed 1 ITEM? Q: How do I display the columns without a loop in this 1 record case...? these fail - so what will work? echo $results[First]; echo $results[First][0]; ??? echo $results[First][1]; ??? While works better than foreach for getting the result rows from PDO -- Thanks, Dave - DealTek deal...@gmail.com [db-3] Have you tried chaining the the fetch() method on as in: $pdo_object-query()-fetch(); Thanks, Ash -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie PDO query display question
When you know there is only one row to be returned you can do this: $photo_category_list = ; $SQL = SELECT category_id, category_name FROM gallery_category ORDER by category_order; try { $stmt = $dbh-prepare($SQL); $stmt-execute(); list( $id, $name) = $stmt-fetch(PDO::FETCH_NUM)); } } catch (PDOException $e){ echo 'Error getting category name. ' . $e-getMessage(); } echo $id; echo $name; And you could also do list( $result[id], $result[name]) = $stmt-fetch(PDO::FETCH_NUM)); -- Stephen Thanks very much for your help Stephen - I will try this asap! -- Thanks, Dave - DealTek deal...@gmail.com [db-3]
Re: [PHP] Newbie Question - Parse XML with PHP...
I have an app that gets passed in xml and use this code to read that data in // We use php://input to get the raw $_POST results. $xml_post = file_get_contents('php://input'); Maybe it will help Bastien On Sat, Apr 20, 2013 at 7:48 AM, shiplu shiplu@gmail.com wrote: Question: how do you use $mylist when the xml is not as a file but is returned on a web page? I assume It returns as a string from page. Then use simplexml_load_string(). See http://php.net/manual/en/function.simplexml-load-string.php -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader -- Bastien Cat, the other other white meat
Re: [PHP] Newbie Question - Parse XML with PHP...
On Apr 22, 2013 7:00 AM, Bastien Koert phps...@gmail.com wrote: I have an app that gets passed in xml and use this code to read that data in // We use php://input to get the raw $_POST results. $xml_post = file_get_contents('php://input'); $xml_post is string. I think now you know what to do.
Re: [PHP] Newbie Question - Parse XML with PHP...
This will be brief as I'm on a tablet... On Apr 19, 2013 5:53 PM, dealTek deal...@gmail.com wrote: On Apr 19, 2013, at 3:32 PM, tamouse mailing lists tamouse.li...@gmail.com wrote: page1.php is sending out to credit card company - getting processed - then coming back to the *same page1.php* with the XML data listed below... Please expand what you mean by sending out and coming back - is this a REST or SOAP API call? In that case, the response body is likely to be the XML. - so I'm not going to some other page to get it - it is coming to me to the same page I am on.. so - after the XML result comes in - I need to assign the php to the XML somehow... How do you recognize the XML result com(ing) in ? Hi tamouse, with my untrained eye - it appears that this is what is 'sending out' $data = sendXMLviaCurl($xmlRequest,$gatewayURL); This is the sending and receiving -- the function uses curl to send your xml request and returns the response from that. and this might be what is 'responding back' on the same page $gwResponse = @new SimpleXMLElement((string)$data); $data contains the response, this is how you are processing it. Skipping the long and monolithic code, what I will suggest is that you break things up into modules, functions and procrdures, and write unit tests that will check each piece seperately. After you've verified that each step is working, then you can start to integrate the pieces, following the stricture of keeping code (logic), data, and presentation seperate. It is much easier to deal with debugging when your code is simple and does only one thing. Break out the part you are asking here about, the API call. Build up a viable test request that will get you a known response and make sure you are getting what you expect. My suspicion is that the response here isnot what you expect.
Re: [PHP] Newbie Question - Parse XML with PHP...
On Sat, Apr 20, 2013 at 12:51 AM, dealTek deal...@gmail.com wrote: On Apr 19, 2013, at 3:32 PM, tamouse mailing lists tamouse.li...@gmail.com wrote: page1.php is sending out to credit card company - getting processed - then coming back to the *same page1.php* with the XML data listed below... Please expand what you mean by sending out and coming back - is this a REST or SOAP API call? In that case, the response body is likely to be the XML. - so I'm not going to some other page to get it - it is coming to me to the same page I am on.. so - after the XML result comes in - I need to assign the php to the XML somehow... How do you recognize the XML result com(ing) in ? Hi tamouse, with my untrained eye - it appears that this is what is 'sending out' $data = sendXMLviaCurl($xmlRequest,$gatewayURL); and this might be what is 'responding back' on the same page $gwResponse = @new SimpleXMLElement((string)$data); you can see these lines towards the bottom at - // Process Step Three... Why did you prefix this with @? This way your hiding the real error that is probably the answer to why it is not working. - Matijn
Re: [PHP] Newbie Question - Parse XML with PHP...
Question: how do you use $mylist when the xml is not as a file but is returned on a web page? I assume It returns as a string from page. Then use simplexml_load_string(). See http://php.net/manual/en/function.simplexml-load-string.php -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
[PHP] Newbie Question - Parse XML with PHP...
Hi all, newbie - just starting with trying to parse XML... $mylist = simplexml_load_file('thelist.xml'); then use a foreach to echo the data... ?php $mysongs = simplexml_load_file('songs.xml'); foreach ($mysongs as $songinfo) { $title=$songinfo-title; $artist=$songinfo-artist; $date=$songinfo['dateplayed']; echo $title.' --- '; echo $artist.' --- '; echo $date.' --- '; echo ' /br '; } ? that I get ... Question: how do you use $mylist when the xml is not as a file but is returned on a web page? an example of the real xml I am trying to work with is like this demo below Goal : when this response comes back - I would like to be able to get the data as php and then update the database example ?xml version=1.0 encoding=UTF-8? response result1/result result-textSUCCESS/result-text transaction-id1865264174/transaction-id result-code100/result-code authorization-code123456/authorization-code avs-resultN/avs-result cvv-resultN/cvv-result action-typesale/action-type amount12.00/amount ip-address::1/ip-address industryecommerce/industry processor-idccprocessora/processor-id currencyUSD/currency order-descriptionSmall Order/order-description merchant-defined-field-1Red/merchant-defined-field-1 merchant-defined-field-2Medium/merchant-defined-field-2 order-id1234/order-id tax-amount2.00/tax-amount shipping-amount0.00/shipping-amount billing first-nameJohn/first-name last-nameSmith/last-name address11234 Main St./address1 cityBeverly Hills/city stateCA/state postal90210/postal countryUS/country phone555-555-/phone emailt...@example.com/email companyAcme, Inc./company cc-number40**0002/cc-number cc-exp0118/cc-exp /billing shipping first-nameMary/first-name last-nameSmith/last-name address11234 Main St./address1 cityBeverly Hills/city stateCA/state postal90210/postal countryUS/country address2Unit #2/address2 /shipping product product-codeSKU-123456/product-code descriptiontest product description/description commodity-codeabc/commodity-code unit-of-measure1/unit-of-measure unit-cost5./unit-cost quantity1./quantity total-amount7.00/total-amount tax-amount2.00/tax-amount tax-rate1.00/tax-rate discount-amount2.00/discount-amount discount-rate1.00/discount-rate tax-typesales/tax-type alternate-tax-id12345/alternate-tax-id /product product product-codeSKU-123456/product-code descriptiontest 2 product description/description commodity-codeabc/commodity-code unit-of-measure2/unit-of-measure unit-cost2.5000/unit-cost quantity2./quantity total-amount7.00/total-amount tax-amount2.00/tax-amount tax-rate1.00/tax-rate discount-amount2.00/discount-amount discount-rate1.00/discount-rate tax-typesales/tax-type alternate-tax-id12345/alternate-tax-id /product /response -- Thanks, Dave - DealTek deal...@gmail.com [db-3]
Re: [PHP] Newbie Question - Parse XML with PHP...
A webpage is a file, that (usually) a browser downloads and parses. You'll do exactly the same :-) I don't know exactly, but you can try to pass the URL directly to simplexml_load_file(). If this doesn't work, download the content (for example with file_get_contents()) and pass it to simplexml_load_string(). There are obviously many other approaches, but you should now have an idea :-) Or you use a specialized library like Guzzle. Am 19.04.2013 22:17 schrieb dealTek deal...@gmail.com: Hi all, newbie - just starting with trying to parse XML... $mylist = simplexml_load_file('thelist.xml'); then use a foreach to echo the data... ?php $mysongs = simplexml_load_file('songs.xml'); foreach ($mysongs as $songinfo) { $title=$songinfo-title; $artist=$songinfo-artist; $date=$songinfo['dateplayed']; echo $title.' --- '; echo $artist.' --- '; echo $date.' --- '; echo ' /br '; } ? that I get ... Question: how do you use $mylist when the xml is not as a file but is returned on a web page? an example of the real xml I am trying to work with is like this demo below Goal : when this response comes back - I would like to be able to get the data as php and then update the database example ?xml version=1.0 encoding=UTF-8? response result1/result result-textSUCCESS/result-text transaction-id1865264174/transaction-id result-code100/result-code authorization-code123456/authorization-code avs-resultN/avs-result cvv-resultN/cvv-result action-typesale/action-type amount12.00/amount ip-address::1/ip-address industryecommerce/industry processor-idccprocessora/processor-id currencyUSD/currency order-descriptionSmall Order/order-description merchant-defined-field-1Red/merchant-defined-field-1 merchant-defined-field-2Medium/merchant-defined-field-2 order-id1234/order-id tax-amount2.00/tax-amount shipping-amount0.00/shipping-amount billing first-nameJohn/first-name last-nameSmith/last-name address11234 Main St./address1 cityBeverly Hills/city stateCA/state postal90210/postal countryUS/country phone555-555-/phone emailt...@example.com/email companyAcme, Inc./company cc-number40**0002/cc-number cc-exp0118/cc-exp /billing shipping first-nameMary/first-name last-nameSmith/last-name address11234 Main St./address1 cityBeverly Hills/city stateCA/state postal90210/postal countryUS/country address2Unit #2/address2 /shipping product product-codeSKU-123456/product-code descriptiontest product description/description commodity-codeabc/commodity-code unit-of-measure1/unit-of-measure unit-cost5./unit-cost quantity1./quantity total-amount7.00/total-amount tax-amount2.00/tax-amount tax-rate1.00/tax-rate discount-amount2.00/discount-amount discount-rate1.00/discount-rate tax-typesales/tax-type alternate-tax-id12345/alternate-tax-id /product product product-codeSKU-123456/product-code descriptiontest 2 product description/description commodity-codeabc/commodity-code unit-of-measure2/unit-of-measure unit-cost2.5000/unit-cost quantity2./quantity total-amount7.00/total-amount tax-amount2.00/tax-amount tax-rate1.00/tax-rate discount-amount2.00/discount-amount discount-rate1.00/discount-rate tax-typesales/tax-type alternate-tax-id12345/alternate-tax-id /product /response -- Thanks, Dave - DealTek deal...@gmail.com [db-3]
Re: [PHP] Newbie Question - Parse XML with PHP...
On Apr 19, 2013, at 1:33 PM, Sebastian Krebs krebs@gmail.com wrote: A webpage is a file, that (usually) a browser downloads and parses. You'll do exactly the same :-) I don't know exactly, but you can try to pass the URL directly to simplexml_load_file(). If this doesn't work, download the content (for example with file_get_contents()) and pass it to simplexml_load_string(). There are obviously many other approaches, but you should now have an idea :-) Thanks Sebastian for the help Actually what is happening in my case is: page1.php is sending out to credit card company - getting processed - then coming back to the *same page1.php* with the XML data listed below... - so I'm not going to some other page to get it - it is coming to me to the same page I am on.. so - after the XML result comes in - I need to assign the php to the XML somehow... I hope I am making myself clear Thanks in advance for the help Or you use a specialized library like Guzzle. Am 19.04.2013 22:17 schrieb dealTek deal...@gmail.com: Hi all, newbie - just starting with trying to parse XML... $mylist = simplexml_load_file('thelist.xml'); then use a foreach to echo the data... ?php $mysongs = simplexml_load_file('songs.xml'); foreach ($mysongs as $songinfo) { $title=$songinfo-title; $artist=$songinfo-artist; $date=$songinfo['dateplayed']; echo $title.' --- '; echo $artist.' --- '; echo $date.' --- '; echo ' /br '; } ? that I get ... Question: how do you use $mylist when the xml is not as a file but is returned on a web page? an example of the real xml I am trying to work with is like this demo below Goal : when this response comes back - I would like to be able to get the data as php and then update the database example ?xml version=1.0 encoding=UTF-8? response result1/result result-textSUCCESS/result-text transaction-id1865264174/transaction-id result-code100/result-code authorization-code123456/authorization-code avs-resultN/avs-result cvv-resultN/cvv-result action-typesale/action-type amount12.00/amount ip-address::1/ip-address industryecommerce/industry processor-idccprocessora/processor-id currencyUSD/currency order-descriptionSmall Order/order-description merchant-defined-field-1Red/merchant-defined-field-1 merchant-defined-field-2Medium/merchant-defined-field-2 order-id1234/order-id tax-amount2.00/tax-amount shipping-amount0.00/shipping-amount billing first-nameJohn/first-name last-nameSmith/last-name address11234 Main St./address1 cityBeverly Hills/city stateCA/state postal90210/postal countryUS/country phone555-555-/phone emailt...@example.com/email companyAcme, Inc./company cc-number40**0002/cc-number cc-exp0118/cc-exp /billing shipping first-nameMary/first-name last-nameSmith/last-name address11234 Main St./address1 cityBeverly Hills/city stateCA/state postal90210/postal countryUS/country address2Unit #2/address2 /shipping product product-codeSKU-123456/product-code descriptiontest product description/description commodity-codeabc/commodity-code unit-of-measure1/unit-of-measure unit-cost5./unit-cost quantity1./quantity total-amount7.00/total-amount tax-amount2.00/tax-amount tax-rate1.00/tax-rate discount-amount2.00/discount-amount discount-rate1.00/discount-rate tax-typesales/tax-type alternate-tax-id12345/alternate-tax-id /product product product-codeSKU-123456/product-code descriptiontest 2 product description/description commodity-codeabc/commodity-code unit-of-measure2/unit-of-measure unit-cost2.5000/unit-cost quantity2./quantity total-amount7.00/total-amount tax-amount2.00/tax-amount tax-rate1.00/tax-rate discount-amount2.00/discount-amount discount-rate1.00/discount-rate tax-typesales/tax-type alternate-tax-id12345/alternate-tax-id /product /response -- Thanks, Dave - DealTek deal...@gmail.com [db-3] -- Thanks, Dave - DealTek deal...@gmail.com [db-3]
Re: [PHP] Newbie Question - Parse XML with PHP...
On Fri, Apr 19, 2013 at 4:04 PM, dealTek deal...@gmail.com wrote: On Apr 19, 2013, at 1:33 PM, Sebastian Krebs krebs@gmail.com wrote: A webpage is a file, that (usually) a browser downloads and parses. You'll do exactly the same :-) I don't know exactly, but you can try to pass the URL directly to simplexml_load_file(). If this doesn't work, download the content (for example with file_get_contents()) and pass it to simplexml_load_string(). There are obviously many other approaches, but you should now have an idea :-) Thanks Sebastian for the help Actually what is happening in my case is: page1.php is sending out to credit card company - getting processed - then coming back to the *same page1.php* with the XML data listed below... Please expand what you mean by sending out and coming back - is this a REST or SOAP API call? In that case, the response body is likely to be the XML. - so I'm not going to some other page to get it - it is coming to me to the same page I am on.. so - after the XML result comes in - I need to assign the php to the XML somehow... How do you recognize the XML result com(ing) in ? I hope I am making myself clear Thanks in advance for the help Or you use a specialized library like Guzzle. Am 19.04.2013 22:17 schrieb dealTek deal...@gmail.com: Hi all, newbie - just starting with trying to parse XML... $mylist = simplexml_load_file('thelist.xml'); then use a foreach to echo the data... ?php $mysongs = simplexml_load_file('songs.xml'); foreach ($mysongs as $songinfo) { $title=$songinfo-title; $artist=$songinfo-artist; $date=$songinfo['dateplayed']; echo $title.' --- '; echo $artist.' --- '; echo $date.' --- '; echo ' /br '; } ? that I get ... Question: how do you use $mylist when the xml is not as a file but is returned on a web page? an example of the real xml I am trying to work with is like this demo below Goal : when this response comes back - I would like to be able to get the data as php and then update the database example ?xml version=1.0 encoding=UTF-8? response result1/result result-textSUCCESS/result-text transaction-id1865264174/transaction-id result-code100/result-code authorization-code123456/authorization-code avs-resultN/avs-result cvv-resultN/cvv-result action-typesale/action-type amount12.00/amount ip-address::1/ip-address industryecommerce/industry processor-idccprocessora/processor-id currencyUSD/currency order-descriptionSmall Order/order-description merchant-defined-field-1Red/merchant-defined-field-1 merchant-defined-field-2Medium/merchant-defined-field-2 order-id1234/order-id tax-amount2.00/tax-amount shipping-amount0.00/shipping-amount billing first-nameJohn/first-name last-nameSmith/last-name address11234 Main St./address1 cityBeverly Hills/city stateCA/state postal90210/postal countryUS/country phone555-555-/phone emailt...@example.com/email companyAcme, Inc./company cc-number40**0002/cc-number cc-exp0118/cc-exp /billing shipping first-nameMary/first-name last-nameSmith/last-name address11234 Main St./address1 cityBeverly Hills/city stateCA/state postal90210/postal countryUS/country address2Unit #2/address2 /shipping product product-codeSKU-123456/product-code descriptiontest product description/description commodity-codeabc/commodity-code unit-of-measure1/unit-of-measure unit-cost5./unit-cost quantity1./quantity total-amount7.00/total-amount tax-amount2.00/tax-amount tax-rate1.00/tax-rate discount-amount2.00/discount-amount discount-rate1.00/discount-rate tax-typesales/tax-type alternate-tax-id12345/alternate-tax-id /product product product-codeSKU-123456/product-code descriptiontest 2 product description/description commodity-codeabc/commodity-code unit-of-measure2/unit-of-measure unit-cost2.5000/unit-cost quantity2./quantity total-amount7.00/total-amount tax-amount2.00/tax-amount tax-rate1.00/tax-rate discount-amount2.00/discount-amount discount-rate1.00/discount-rate tax-typesales/tax-type alternate-tax-id12345/alternate-tax-id /product /response -- Thanks, Dave - DealTek deal...@gmail.com [db-3] -- Thanks, Dave - DealTek deal...@gmail.com [db-3] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question - Parse XML with PHP...
On Apr 19, 2013, at 3:32 PM, tamouse mailing lists tamouse.li...@gmail.com wrote: page1.php is sending out to credit card company - getting processed - then coming back to the *same page1.php* with the XML data listed below... Please expand what you mean by sending out and coming back - is this a REST or SOAP API call? In that case, the response body is likely to be the XML. - so I'm not going to some other page to get it - it is coming to me to the same page I am on.. so - after the XML result comes in - I need to assign the php to the XML somehow... How do you recognize the XML result com(ing) in ? Hi tamouse, with my untrained eye - it appears that this is what is 'sending out' $data = sendXMLviaCurl($xmlRequest,$gatewayURL); and this might be what is 'responding back' on the same page $gwResponse = @new SimpleXMLElement((string)$data); you can see these lines towards the bottom at - // Process Step Three... --- the page code is long - so i cut out some extra lines - but this is === all page code - with edits... ?php // API Setup Parameters $gatewayURL = 'https://secure.webxxx.com/api/test'; $APIKey = 'xxx'; // If there is no POST data or a token-id, print the initial shopping cart form to get ready for Step One. if (empty($_POST['DO_STEP_1']) empty($_GET['token-id'])) { print ' !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;'; print ' html head meta http-equiv=Content-Type content=text/html; charset=UTF-8 / titleCollect non-sensitive Customer Info /title /head body ph2Step One: Collect non-sensitive payment information.br //h2/p h3 Customer Information/h3 h4 Billing Details/h4 form action= method=post table trtdCompany/tdtdinput type=text name=billing-address-company value=Acme, Inc./td/tr --- more trtdh4br / Shipping Details/h4 --more trtd colspan=2nbsp;/td trtd colspan=2 align=centerTotal Amount $12.00 /td/tr trtd colspan=2 align=centerinput type=submit value=Submit Step Oneinput type=hidden name =DO_STEP_1 value=true/td/tr /table /form /body /html '; }else if (!empty($_POST['DO_STEP_1'])) { // Initiate Step One: Now that we've collected the non-sensitive payment information, we can combine other order information and build the XML format. $xmlRequest = new DOMDocument('1.0','UTF-8'); $xmlRequest-formatOutput = true; $xmlSale = $xmlRequest-createElement('sale'); // Amount, authentication, and Redirect-URL are typically the bare mininum. appendXmlNode($xmlSale,'api-key',$APIKey); appendXmlNode($xmlSale,'redirect-url',$_SERVER['HTTP_REFERER']); appendXmlNode($xmlSale, 'amount', '12.00'); appendXmlNode($xmlSale, 'ip-address', $_SERVER[REMOTE_ADDR]); //appendXmlNode($xmlSale, 'processor-id' , 'processora'); appendXmlNode($xmlSale, 'currency', 'USD'); //appendXmlNode($xmlSale, 'dup-seconds' , '2'); // Some additonal fields may have been previously decided by user appendXmlNode($xmlSale, 'order-id', '1234'); appendXmlNode($xmlSale, 'order-description', 'Small Order'); appendXmlNode($xmlSale, 'merchant-defined-field-1' , 'Red'); appendXmlNode($xmlSale, 'merchant-defined-field-2', 'Medium'); appendXmlNode($xmlSale, 'tax-amount' , '2.00'); appendXmlNode($xmlSale, 'shipping-amount' , '0.00'); /*if(!empty($_POST['customer-vault-id'])) { appendXmlNode($xmlSale, 'customer-vault-id' , $_POST['customer-vault-id']); }else { $xmlAdd = $xmlRequest-createElement('add-customer'); appendXmlNode($xmlAdd, 'customer-vault-id' ,411); $xmlSale-appendChild($xmlAdd); }*/ // Set the Billing Shipping from what was collected on initial shopping cart form $xmlBillingAddress = $xmlRequest-createElement('billing'); appendXmlNode($xmlBillingAddress,'first-name', $_POST['billing-address-first-name']); //-more //billing-address-email appendXmlNode($xmlBillingAddress,'country', $_POST['billing-address-country']); appendXmlNode($xmlBillingAddress,'email', $_POST['billing-address-email']); //more $xmlSale-appendChild($xmlBillingAddress); $xmlShippingAddress = $xmlRequest-createElement('shipping'); appendXmlNode($xmlShippingAddress,'first-name', $_POST['shipping-address-first-name']); appendXmlNode($xmlShippingAddress,'last-name', $_POST['shipping-address-last-name']); // more appendXmlNode($xmlShippingAddress,'fax', $_POST['shipping-address-fax']); $xmlSale-appendChild($xmlShippingAddress);
Re: [PHP] Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class (using CRUD)
On Feb 14, 2013, at 11:46 AM, Bastien Koert phps...@gmail.com wrote: The DreamInCode one is good. MySQLi is the recommended option over MySQL since the mysql one is deprecated. PDO is also a great option since you can prepare your queries to help sanitize the data -- Bastien Thanks Bastien, I imagine this is what you were referring to? http://www.dreamincode.net/forums/topic/54239-introduction-to-mysqli-and-prepared-statements/ -- Thanks, Dave - DealTek deal...@gmail.com [db-3]
[PHP] Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class (using CRUD)
Hi everybody, Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class (using CRUD) Simple story: creating this class database by myself is way over my head. So it be best for me to find something on the Internet that has already been created and working to pro specs (using CRUD with good security etc). In my studying, it seems that there is a difference between MySQL and MySQLi - MySQLi being the preferred choice if I understand correctly. There are lots of examples on the Internet however I don't know enough about it to know a good starting example from a bad starting example, so I would much appreciate any assistance pointing me towards a good starting point This seems a good start to me untrained eye, but it seems to be for mysql - not mysqli... http://net.tutsplus.com/tutorials/php/real-world-oop-with-php-and-mysql/ http://www.dreamincode.net/forums/topic/223360-connect-to-your-database-using-oop-php5-with-mysql-and-mysqli/ http://snipplr.com/view/8417/ http://snipplr.com/view/12535/ any assistance is appreciated! -- Thanks, Dave - DealTek deal...@gmail.com [db-3] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class (using CRUD)
I recommend a third option, that is PDO. Start here please. http://net.tutsplus.com/?s=pdo On Thu, Feb 14, 2013 at 9:49 AM, dealTek deal...@gmail.com wrote: Hi everybody, Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class (using CRUD) Simple story: creating this class database by myself is way over my head. So it be best for me to find something on the Internet that has already been created and working to pro specs (using CRUD with good security etc). In my studying, it seems that there is a difference between MySQL and MySQLi - MySQLi being the preferred choice if I understand correctly. There are lots of examples on the Internet however I don't know enough about it to know a good starting example from a bad starting example, so I would much appreciate any assistance pointing me towards a good starting point This seems a good start to me untrained eye, but it seems to be for mysql - not mysqli... http://net.tutsplus.com/tutorials/php/real-world-oop-with-php-and-mysql/ http://www.dreamincode.net/forums/topic/223360-connect-to-your-database-using-oop-php5-with-mysql-and-mysqli/ http://snipplr.com/view/8417/ http://snipplr.com/view/12535/ any assistance is appreciated! -- Thanks, Dave - DealTek deal...@gmail.com [db-3] -- 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] Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class (using CRUD)
On Thu, Feb 14, 2013 at 1:24 PM, Haluk Karamete halukkaram...@gmail.com wrote: I recommend a third option, that is PDO. Start here please. http://net.tutsplus.com/?s=pdo On Thu, Feb 14, 2013 at 9:49 AM, dealTek deal...@gmail.com wrote: Hi everybody, Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class (using CRUD) Simple story: creating this class database by myself is way over my head. So it be best for me to find something on the Internet that has already been created and working to pro specs (using CRUD with good security etc). In my studying, it seems that there is a difference between MySQL and MySQLi - MySQLi being the preferred choice if I understand correctly. There are lots of examples on the Internet however I don't know enough about it to know a good starting example from a bad starting example, so I would much appreciate any assistance pointing me towards a good starting point This seems a good start to me untrained eye, but it seems to be for mysql - not mysqli... http://net.tutsplus.com/tutorials/php/real-world-oop-with-php-and-mysql/ http://www.dreamincode.net/forums/topic/223360-connect-to-your-database-using-oop-php5-with-mysql-and-mysqli/ http://snipplr.com/view/8417/ http://snipplr.com/view/12535/ any assistance is appreciated! -- Thanks, Dave - DealTek deal...@gmail.com [db-3] -- 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 The DreamInCode one is good. MySQLi is the recommended option over MySQL since the mysql one is deprecated. PDO is also a great option since you can prepare your queries to help sanitize the data -- Bastien Cat, the other other white meat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie with imap_mail_move
Hi all, I'm a newbie with imap_mail_move trying to open the INBOX and move all mail to LEGACY folder box (got this code from the net) it shows these errors... any idea how to fix this? --- Warning: reset() [function.reset]: Passed variable is not an array or object in /home/bbeast/public_html/emtest/em-move.php on line 91 Warning: implode() [function.implode]: Invalid arguments passed in /home/bbeast/public_html/emtest/em-move.php on line 92 Notice: Unknown: Error in IMAP command received by server. (errflg=2) in Unknown on line 0 --- ?php $host1='{mail.xxx.com:993/ssl/novalidate-cert}INBOX'; $user='xxx'; $pass='xxx'; $mbox=@imap_open($host1,$user,$pass) or die(Can't connect: . imap_last_error()); $mbox_name = INBOX; $newmbox_name = LEGACY; if ($mbox_name != $newmbox_name) { reset($msg_no); $messageset = implode (,,$msg_no); imap_mail_move($mbox,$messageset,$newmbox_name); imap_expunge($mbox); } imap_close($mbox); ? -- Thanks, Dave - DealTek deal...@gmail.com [db-3] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie with imap_mail_move
On Sat, Feb 9, 2013 at 7:29 PM, dealTek deal...@gmail.com wrote: Warning: reset() [function.reset]: Passed variable is not an array or object in /home/bbeast/public_html/emtest/em-move.php on line 91 if ($mbox_name != $newmbox_name) { reset($msg_no); $messageset = implode (,,$msg_no); imap_mail_move($mbox,$messageset,$newmbox_name); imap_expunge($mbox); } Where is the variable $msg_no coming from? Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com
[PHP] Newbie question: replacing truetype fonts with UTF8 encoded Unicode characters
Greetings I have some HTML text using truetype fonts which i have to convert to UTF8 encoded unicode characters. I am just trying to replace the truetype font characters. The problem is that somehow the HTML tags also get converted to UTF8 :-( I do a lot of str_replace such as the following: $body = str_replace(þ, க்ஷ, $body); $body = str_replace(þ£, க்ஷா, $body); $body = str_replace(¬þ, க்ஷை, $body); $body = str_replace(V, க்ஷி, $body); $body = str_replace(r, க்ஷீ, $body); $body = str_replace(þ§, க்ஷு, $body); $body = str_replace(þ¨, க்ஷூ, $body); I guess i am missing something as silly as encoding the characters into certain type of strings, do the conversion and then convert to back to UTF8 How best to do this? Sorry if this is a very basic question. Thanks a lot in advance Regards Venkatesh
[PHP] Newbie security database connection question
Hello, NEWBIE: I have a security question: When working with PHP and MySQL, it seems that a one method is to create a connection.php page to the database that will store the connection parameters such as username, password and URL ip in clear text and include this on various pages. Since hackers seem to be getting better and better every day: - Is this common practice to store this security data in the clear on the PHP webpage? - Wouldn't it be possible for a hacker to SNIFF around and pick up this sensitive clear text security data? - Is there some better, more secure way to communicate from the website to the MySQL data source that is somehow sending encrypted information rather than clear text back and forth? Thanks in advance for your help. -- Thanks, Dave - DealTek deal...@gmail.com [db-11] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie security database connection question
On Sat, Aug 20, 2011 at 6:22 AM, DealTek deal...@gmail.com wrote: Hello, NEWBIE: I have a security question: When working with PHP and MySQL, it seems that a one method is to create a connection.php page to the database that will store the connection parameters such as username, password and URL ip in clear text and include this on various pages. Since hackers seem to be getting better and better every day: - Is this common practice to store this security data in the clear on the PHP webpage? - Wouldn't it be possible for a hacker to SNIFF around and pick up this sensitive clear text security data? - Is there some better, more secure way to communicate from the website to the MySQL data source that is somehow sending encrypted information rather than clear text back and forth? Thanks in advance for your help. You can encrypt the access credentails using some public key encryption technique like RSA and then decode it inside php before connecting to db... But still you have to store the private key in plain text somewere... OR may be you can use 'hard to guess substitution ciphers' [i dunno if tht exists] or create an encryption logic of your own and then use it to encrypt the dataabse uname and pass. Regards Midhun Girish
Re: [PHP] Newbie security database connection question
On Aug 19, 2011, at 7:52 PM, DealTek wrote: Hello, NEWBIE: I have a security question: When working with PHP and MySQL, it seems that a one method is to create a connection.php page to the database that will store the connection parameters such as username, password and URL ip in clear text and include this on various pages. Since hackers seem to be getting better and better every day: - Is this common practice to store this security data in the clear on the PHP webpage? - Wouldn't it be possible for a hacker to SNIFF around and pick up this sensitive clear text security data? - Is there some better, more secure way to communicate from the website to the MySQL data source that is somehow sending encrypted information rather than clear text back and forth? Thanks in advance for your help. If your web server and MySQL server are running on the same host, make sure your db user only has access via localhost. If your web server running php is on a different host from your MySQL server, set the host access for that db user to only allow access from the web server host. If you are running MySQL 5, you can secure the connection using SSL to ensure that a sniffer will have a much more difficult time stealing your credentials. Another way is to set up an SSH tunnel. A couple other things: * generally, it is considered a good practice to store access credentials used by a php application *outside* the web server's visibility. * include the php script in whatever other main scripts your application has, and make it readable only to the web server user/group. * if anything else, make sure the file has the extension .php and the credentials are inside the php code space so it can't be downloaded directly by a web user. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie question. What is the best structure of a php-app?
Hi, Surely there's a wiki/doc somewhere :) But for the start: 1) plan what exactly you want to accomplish ( functionality ) 2) complexity - if simple, just throw it in one php ( like index.php ) - if more complex, you can separate the pages and/or use classes 3) based on 2), plan the structure ( I'm using mostly one entry point - index.php - with classes, templates, files included, since I like things separated ) Some thing you should not forget: - whole webapp thing is event based ( client will do something - press a link - and the server will react ) - the connection is not maintained all the time - PHP is server side (harder to debug), you cannot do anything on client side ( just push what to display ) ( JS is client side ) - you can start the session whenever you want ( it's nearly the first line of my app ), but you should control the access with variables, like if ( $_SESSION['uid'] ) or if ( $_SESSION['loggedin'] ) - most webservers interprets things between ?php ? even if the file name ends with .htm or .html - for JS and connection related things FireBug for FireFox is a good idea ( you can track, what's submitted, etc ) What I'm liking: - one entry point ( index.php ) - sub-pages, are separate php/template pairs BUT are included from index.php ( after access verification, etc ) - nearly all the functions are put in separate classes ( like user.class.php for user related things - login,logout, etc ) - using a template engine is not a very bad idea ( like Smarty ), you can separate the real code from html, which make debugging easier - at least for me :) BTW, take a look on some free stuff. You can always learn from others. There are some good ideas in open CMS systems, like Joomla. Cheers, Tom -Original Message- From: Andreas [mailto:maps...@gmx.net] Sent: Tuesday, August 16, 2011 12:39 AM To: php-general@lists.php.net Subject: [PHP] Newbie question. What is the best structure of a php-app? Hi, I'm fairly new to PHP but not to programming as such. Currently I sat up XAMPP with xdebug, Netbeans and Eclipse to get a feeling. I can write and run php-files but I am wondering how I should construct a more complex application that runs over several pages between a login and a logout. How would I structure such an application so that it is possible to run it in the debugger from the beginning? E.g. as a simple example I may build an index.html that has a menue with links to 3 php-files. 1) login.php 2) enter_data.php 3) list_data.php as html-links within an ul-list. The user should at first click on login where user/password gets entered an a session starts. Then the application comes back to index.html. Now he might click 2) ... Is it possible to run the whole application from the start on? index.html is no php so xdebug won't process it and therefore the IDEs may start index.html but can't show the stage where the page is just waiting e.g. for a click on login and later branch for the other options. Even if I write an index.php that shows the menue eventually the script just dumps the html that'll wait for the following clicks. Those following steps are far more likely in need to be debugged. Is it neccessary to debug those subpages separately even though they need prior steps like login.php that store some infos in a session or cookie that later scripts need to rely on? Can I somehow watch what is going on from the index.html on? Until now I just found documentation that explains the php language. Thats good too but I'd need to get an idea about the web-app-thinking that consist of just pages where the designer has to hope that the user stays within the applicationflow instead of clicking unexpectedly on the back-button or just jumping off to some other site if he likes to. In contrast to this desktop-apps seem to be less demanding because I know where a user can navigate from a certain stage within the app and I could step from program start to stop with the debugger if I feel the need to. Is there a tutorial that explains how to build consistent web-apps beyond the details of php language? regards... -- 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] Newbie question. What is the best structure of a php-app?
On 16 August 2011 09:53, Dajka Tamás vi...@vipernet.hu wrote: Hi, Surely there's a wiki/doc somewhere :) But for the start: 1) plan what exactly you want to accomplish ( functionality ) 2) complexity - if simple, just throw it in one php ( like index.php ) - if more complex, you can separate the pages and/or use classes 3) based on 2), plan the structure ( I'm using mostly one entry point - index.php - with classes, templates, files included, since I like things separated ) Some thing you should not forget: - whole webapp thing is event based ( client will do something - press a link - and the server will react ) - the connection is not maintained all the time - PHP is server side (harder to debug), you cannot do anything on client side ( just push what to display ) ( JS is client side ) - you can start the session whenever you want ( it's nearly the first line of my app ), but you should control the access with variables, like if ( $_SESSION['uid'] ) or if ( $_SESSION['loggedin'] ) - most webservers interprets things between ?php ? even if the file name ends with .htm or .html - for JS and connection related things FireBug for FireFox is a good idea ( you can track, what's submitted, etc ) What I'm liking: - one entry point ( index.php ) - sub-pages, are separate php/template pairs BUT are included from index.php ( after access verification, etc ) - nearly all the functions are put in separate classes ( like user.class.php for user related things - login,logout, etc ) - using a template engine is not a very bad idea ( like Smarty ), you can separate the real code from html, which make debugging easier - at least for me :) BTW, take a look on some free stuff. You can always learn from others. There are some good ideas in open CMS systems, like Joomla. Cheers, Tom -Original Message- From: Andreas [mailto:maps...@gmx.net] Sent: Tuesday, August 16, 2011 12:39 AM To: php-general@lists.php.net Subject: [PHP] Newbie question. What is the best structure of a php-app? Hi, I'm fairly new to PHP but not to programming as such. Currently I sat up XAMPP with xdebug, Netbeans and Eclipse to get a feeling. I can write and run php-files but I am wondering how I should construct a more complex application that runs over several pages between a login and a logout. How would I structure such an application so that it is possible to run it in the debugger from the beginning? E.g. as a simple example I may build an index.html that has a menue with links to 3 php-files. 1) login.php 2) enter_data.php 3) list_data.php as html-links within an ul-list. The user should at first click on login where user/password gets entered an a session starts. Then the application comes back to index.html. Now he might click 2) ... Is it possible to run the whole application from the start on? index.html is no php so xdebug won't process it and therefore the IDEs may start index.html but can't show the stage where the page is just waiting e.g. for a click on login and later branch for the other options. Even if I write an index.php that shows the menue eventually the script just dumps the html that'll wait for the following clicks. Those following steps are far more likely in need to be debugged. Is it neccessary to debug those subpages separately even though they need prior steps like login.php that store some infos in a session or cookie that later scripts need to rely on? Can I somehow watch what is going on from the index.html on? Until now I just found documentation that explains the php language. Thats good too but I'd need to get an idea about the web-app-thinking that consist of just pages where the designer has to hope that the user stays within the applicationflow instead of clicking unexpectedly on the back-button or just jumping off to some other site if he likes to. In contrast to this desktop-apps seem to be less demanding because I know where a user can navigate from a certain stage within the app and I could step from program start to stop with the debugger if I feel the need to. Is there a tutorial that explains how to build consistent web-apps beyond the details of php language? regards... I like the Zend Framework layout where the class names and file names are created according to a standard (http://groups.google.com/group/php-standards/web/psr-0-final-proposal?pli=1) And by putting the codebase outside of docroot (include_path is your friend here), you allow the framework to be used on multiple sites on the same server. For me, the only things I have in my docroot are statics (css, js, images, html) and index.php (though occasional one-shot utils will exist there). When I develop, I have 3 versions of the site (live, test and dev). www.site.com, test.site.com and dev.site.com I have separate SQL Server instances (I'm on Windows and mainly develop for MS SQL Server
[PHP] Newbie question. What is the best structure of a php-app?
Hi, I'm fairly new to PHP but not to programming as such. Currently I sat up XAMPP with xdebug, Netbeans and Eclipse to get a feeling. I can write and run php-files but I am wondering how I should construct a more complex application that runs over several pages between a login and a logout. How would I structure such an application so that it is possible to run it in the debugger from the beginning? E.g. as a simple example I may build an index.html that has a menue with links to 3 php-files. 1) login.php 2) enter_data.php 3) list_data.php as html-links within an ul-list. The user should at first click on login where user/password gets entered an a session starts. Then the application comes back to index.html. Now he might click 2) ... Is it possible to run the whole application from the start on? index.html is no php so xdebug won't process it and therefore the IDEs may start index.html but can't show the stage where the page is just waiting e.g. for a click on login and later branch for the other options. Even if I write an index.php that shows the menue eventually the script just dumps the html that'll wait for the following clicks. Those following steps are far more likely in need to be debugged. Is it neccessary to debug those subpages separately even though they need prior steps like login.php that store some infos in a session or cookie that later scripts need to rely on? Can I somehow watch what is going on from the index.html on? Until now I just found documentation that explains the php language. Thats good too but I'd need to get an idea about the web-app-thinking that consist of just pages where the designer has to hope that the user stays within the applicationflow instead of clicking unexpectedly on the back-button or just jumping off to some other site if he likes to. In contrast to this desktop-apps seem to be less demanding because I know where a user can navigate from a certain stage within the app and I could step from program start to stop with the debugger if I feel the need to. Is there a tutorial that explains how to build consistent web-apps beyond the details of php language? regards... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie date time question
I'm trying to convert a date and time string using strtotime() The date and time strings are the first entry in each line in a csv file in the form: 22/06/2011 9:47:20 PM, data1, data2,... I've been trying to use the following approach, without success: function read_data($filename) { $f = fopen($filename, 'r'); while ($d = fgetcsv($f)) { $format = 'd/m/Y h:i:s'; $dt = DateTime::createFromFormat($format, $d[0]); $data[] = array(strtotime($dt), $d[1]); //convert date/time } fclose($f); return $data; } Obviously I'm not getting the $format line right, as the resulting $dt values are empty. (I have previously used this reading process successfully with better behaved date and time strings). Advice appreciated. DN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie date time question
On 23/06/11 12:23 AM, Adam Balogh wrote: hi, you have a PM(/AM) in your date ($d[0]), so put an A (Uppercase Ante meridiem and Post meridiem) format char to your $format variable. b3ha Thanks, Adam. Tried that and it's now throwing an error: Catchable fatal error: Object of class DateTime could not be converted to string in xxx.php on line 12 Line 12 follows the attempt at conversion 10 $format = 'd/m/Y h:i:s A'; 11 $dt = DateTime::createFromFormat($format, $d[0]); 12 echo $dt,...; DN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie date time question
On 23/06/11 12:30 AM, Richard Quadling wrote: On 22 June 2011 15:05, David Nichollsd...@dcnicholls.com wrote: I'm trying to convert a date and time string using strtotime() The date and time strings are the first entry in each line in a csv file in the form: 22/06/2011 9:47:20 PM, data1, data2,... I've been trying to use the following approach, without success: function read_data($filename) { $f = fopen($filename, 'r'); while ($d = fgetcsv($f)) { $format = 'd/m/Y h:i:s'; $dt = DateTime::createFromFormat($format, $d[0]); $data[] = array(strtotime($dt), $d[1]); //convert date/time } fclose($f); return $data; } Obviously I'm not getting the $format line right, as the resulting $dt values are empty. (I have previously used this reading process successfully with better behaved date and time strings). Advice appreciated. DN ?php $data = '22/06/2011 9:47:20 PM'; $format = 'd/m/Y g:i:s A'; $datetime = DateTime::createFromFormat($format, $data); echo date('r', $datetime-getTimestamp()); ? outputs ... Wed, 22 Jun 2011 21:47:20 +0100 Yes, partly works, but I'm now getting: Wed, 22 Jun 2011 20:19:56 +1000 Warning: strtotime() expects parameter 1 to be string, object given in xxx.php on line 12 in: 5 function read_data($filename) 6 { 7 $f = fopen($filename, 'r'); 8 while ($d = fgetcsv($f)) { 9 $format = 'd/m/Y g:i:s A'; 10 $dt = DateTime::createFromFormat($format, $d[0]); 11 echo date('r', $dt-getTimestamp()); 12$data[] = array(strtotime($dt), $d[1]); //convert date/time 13} 14fclose($f); 15return $data; 15} So $dt is apparently not a string? DN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie date time question
$dt is an object as the error says, so you cant echo it, becouse its not a string (it can be with __toString magic method, or use print_r/var_dump to output your object). Try the format ( http://www.php.net/manual/en/datetime.format.php) method on your $dt object. On Wed, Jun 22, 2011 at 4:41 PM, David Nicholls d...@dcnicholls.com wrote: On 23/06/11 12:23 AM, Adam Balogh wrote: hi, you have a PM(/AM) in your date ($d[0]), so put an A (Uppercase Ante meridiem and Post meridiem) format char to your $format variable. b3ha Thanks, Adam. Tried that and it's now throwing an error: Catchable fatal error: Object of class DateTime could not be converted to string in xxx.php on line 12 Line 12 follows the attempt at conversion 10 $format = 'd/m/Y h:i:s A'; 11 $dt = DateTime::createFromFormat($**format, $d[0]); 12 echo $dt,...; DN
Re: [PHP] newbie date time question
On 22 June 2011 15:05, David Nicholls d...@dcnicholls.com wrote: I'm trying to convert a date and time string using strtotime() The date and time strings are the first entry in each line in a csv file in the form: 22/06/2011 9:47:20 PM, data1, data2,... I've been trying to use the following approach, without success: function read_data($filename) { $f = fopen($filename, 'r'); while ($d = fgetcsv($f)) { $format = 'd/m/Y h:i:s'; $dt = DateTime::createFromFormat($format, $d[0]); $data[] = array(strtotime($dt), $d[1]); //convert date/time } fclose($f); return $data; } Obviously I'm not getting the $format line right, as the resulting $dt values are empty. (I have previously used this reading process successfully with better behaved date and time strings). Advice appreciated. DN ?php $data = '22/06/2011 9:47:20 PM'; $format = 'd/m/Y g:i:s A'; $datetime = DateTime::createFromFormat($format, $data); echo date('r', $datetime-getTimestamp()); ? outputs ... Wed, 22 Jun 2011 21:47:20 +0100 -- Richard Quadling Twitter : EE : Zend : PHPDoc @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie date time question
OK, looks like I have fixed problem, using: $format = 'd/m/Y g:i:s A'; $dt = date_create_from_format($format, $d[0]); $dt2 = date('r', $dt-getTimestamp()); $data[] = array(strtotime($dt2), $d[1]); Not elegant but it gives me the date/time value. Thanks, Adam and Richard DN On 23/06/11 12:51 AM, Adam Balogh wrote: $dt is an object as the error says, so you cant echo it, becouse its not a string (it can be with __toString magic method, or use print_r/var_dump to output your object). Try the format ( http://www.php.net/manual/en/datetime.format.php) method on your $dt object. On Wed, Jun 22, 2011 at 4:41 PM, David Nichollsd...@dcnicholls.com wrote: On 23/06/11 12:23 AM, Adam Balogh wrote: hi, you have a PM(/AM) in your date ($d[0]), so put an A (Uppercase Ante meridiem and Post meridiem) format char to your $format variable. b3ha Thanks, Adam. Tried that and it's now throwing an error: Catchable fatal error: Object of class DateTime could not be converted to string inxxx.php on line 12 Line 12 follows the attempt at conversion 10 $format = 'd/m/Y h:i:s A'; 11 $dt = DateTime::createFromFormat($**format, $d[0]); 12 echo $dt,...; DN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie date time question
On Wednesday, 22 June 2011 at 15:59, David Nicholls wrote: OK, looks like I have fixed problem, using: $format = 'd/m/Y g:i:s A'; $dt = date_create_from_format($format, $d[0]); $dt2 = date('r', $dt-getTimestamp()); $data[] = array(strtotime($dt2), $d[1]); Not elegant but it gives me the date/time value. $dt-getTimestamp() will give you the same value as strtotime($dt2), so you don't need the inelegance. $format = 'd/m/Y g:i:s A'; $dt = date_create_from_format($format, $d[0]); $data[] = array($dt-getTimestamp(), $d[1]); -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie date time question
On 23/06/11 1:02 AM, Stuart Dallas wrote: On Wednesday, 22 June 2011 at 15:59, David Nicholls wrote: OK, looks like I have fixed problem, using: $format = 'd/m/Y g:i:s A'; $dt = date_create_from_format($format, $d[0]); $dt2 = date('r', $dt-getTimestamp()); $data[] = array(strtotime($dt2), $d[1]); Not elegant but it gives me the date/time value. $dt-getTimestamp() will give you the same value as strtotime($dt2), so you don't need the inelegance. $format = 'd/m/Y g:i:s A'; $dt = date_create_from_format($format, $d[0]); $data[] = array($dt-getTimestamp(), $d[1]); -Stuart Thanks, Stuart. That's much prettier! DN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] newbie - function is undefined
[snip] JavaScript is a browser-side language, browsers have cache, cache sticks around, meaning that you can tell the browser to cache the JS file and not download it from the server (every time) if its being included on the browser end (which js is). All means faster page load times post initial load, and less bandwidth. If you include the JS file with php, every time you request the page the javascript will be pulled from your hard drive by php and sent back as a part of the server response (your end web page). [/snip] So all of the pages I generate with PHP that call JavaScript functions and libraries are doing it wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie - function is undefined
On 4 April 2011 12:12, Jay Blanchard jblanch...@pocket.com wrote: So all of the pages I generate with PHP that call JavaScript functions and libraries are doing it wrong? Short answer : yes. Medium answer : probably, but really yes. Long answer : unless you are providing some sort of mechanism to hold the current state of PHP, eject the required JS code to get a value from the client and return it to the server which then recreates the working environment and carries on execution (try debugging THAT), then almost certainly. Under normal circumstances, the PHP code is completely finished running before anything gets to the client. There is no mechanism for allowing _this_ script to get a response to a JS call whilst running. It is like the game of pass the parcel. Your job (as in the PHP script) is to unwrap 1 layer of paper and pass it on. That's it. PHP runs and builds the appropriate output in response to the request that the server directed to the PHP handler. Once the output has been passed to the server, the PHP script is finished. Whilst building the output, PHP cannot talk to the client. At the most fundamental level, the client (the browser) is not listening for anyone other than a response to the request it made to the server. -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] newbie - function is undefined
[snip] Short answer : yes. Medium answer : probably, but really yes. Long answer : unless you are providing some sort of mechanism to hold the current state of PHP, eject the required JS code to get a value from the client and return it to the server which then recreates the working environment and carries on execution (try debugging THAT), then almost certainly. [/snip] So dynamically generated pages by PHP shouldn't spit out any JS of any type? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] newbie - function is undefined
On Mon, 2011-04-04 at 08:03 -0500, Jay Blanchard wrote: [snip] Short answer : yes. Medium answer : probably, but really yes. Long answer : unless you are providing some sort of mechanism to hold the current state of PHP, eject the required JS code to get a value from the client and return it to the server which then recreates the working environment and carries on execution (try debugging THAT), then almost certainly. [/snip] So dynamically generated pages by PHP shouldn't spit out any JS of any type? That's not what he said. PHP can more than adequately output Javascript (or any other kind of output you can think of really, such as XML, PDF, images, etc), it's just generally most people use it to output HTML. Quite often it's easiest when passing data from PHP to Javascript to do it by outputting Javascript code directly, but it does help to separate PHP from the client-side. So rather than think of embedding PHP in an HTML file, it's really the other way around, because as soon as you take an HTML file and include PHP, the whole thing is parsed by php the program on the server, which then outputs HTML to Apache, rather than Apache just grabbing the plain HTML and sending it to the client. Because web servers (typically) don't parse Javascript code, PHP knows nothing about the functions you've declared in it, even if PHP was responsible for outputting the Javascript code itself, in much the same way that you wouldn't expect PHP to output CSS and know whether your browser has correcly applied the styles or not. Everything that happens on the client-side is outside of PHP and the server. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] newbie - function is undefined
On 4 April 2011 14:03, Jay Blanchard jblanch...@pocket.com wrote: [snip] Short answer : yes. Medium answer : probably, but really yes. Long answer : unless you are providing some sort of mechanism to hold the current state of PHP, eject the required JS code to get a value from the client and return it to the server which then recreates the working environment and carries on execution (try debugging THAT), then almost certainly. [/snip] So dynamically generated pages by PHP shouldn't spit out any JS of any type? Oh no no no. You can use PHP to GENERATE JS, CSS, HTML, XML, etc. You just can't CALL JS from PHP and get a response. I use PHP to create JS code a LOT. The CSS/JS Combinator uses PHP to shrink and cache the JS and CSS code to reduce the number of hits a page generates. -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie - function is undefined
On Mon, Apr 04, 2011 at 08:03:46AM -0500, Jay Blanchard wrote: [snip] Short answer : yes. Medium answer : probably, but really yes. Long answer : unless you are providing some sort of mechanism to hold the current state of PHP, eject the required JS code to get a value from the client and return it to the server which then recreates the working environment and carries on execution (try debugging THAT), then almost certainly. [/snip] So dynamically generated pages by PHP shouldn't spit out any JS of any type? Spit out all the Javascript you want with dynamically generated PHP pages. Just don't try to call a Javascript function from PHP. That was the OP's mistake. Paul -- Paul M. Foster http://noferblatz.com http://quillandmouse.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] newbie - function is undefined
[snip] Oh no no no. You can use PHP to GENERATE JS, CSS, HTML, XML, etc. You just can't CALL JS from PHP and get a response.[/snip] Fair enough, I just wanted to make sure that we were all on the same page because some of the answers given to the OP may have been somewhat confusing. Many of you know how much I have tried to make sure that posters in the past have understood the difference between client-side vs. server-side. AJAX blurs that line for some developers but I still believe that line to be steadfastly in place. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie - function is undefined
Maybe try: echo 'getText(p1)'; I think that should work. Good luck. Cheers, Micky -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie - function is undefined
Thanks - now I see. the message means that it can't find a php function called getText. Doh! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie - function is undefined
function. Try something like: ... echo 'heaading contains: scriptgetText(h2)/script'; ... I tried it - no better. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie - function is undefined
On Fri, Apr 1, 2011 at 2:32 PM, Jim Giner jim.gi...@albanyhandball.comwrote: function. Try something like: ... echo 'heaading contains: scriptgetText(h2)/script'; ... I tried it - no better. Did you still get the function undefined error? -- Sláinte, Richard S. Crawford (rich...@underpope.com) http://www.underpope.com Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)
Re: [PHP] newbie - function is undefined
JavaScript is a browser-side language, browsers have cache, cache sticks around, meaning that you can tell the browser to cache the JS file and not download it from the server (every time) if its being included on the browser end (which js is). All means faster page load times post initial load, and less bandwidth. If you include the JS file with php, every time you request the page the javascript will be pulled from your hard drive by php and sent back as a part of the server response (your end web page). ~ Alex On Fri, Apr 1, 2011 at 5:32 PM, Jim Giner jim.gi...@albanyhandball.comwrote: function. Try something like: ... echo 'heaading contains: scriptgetText(h2)/script'; ... I tried it - no better. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie - function is undefined
And the way to do this is? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie - function is undefined
On Friday, 1 April 2011 at 22:43, Alex Nikitin wrote: JavaScript is a browser-side language, browsers have cache, cache sticks around, meaning that you can tell the browser to cache the JS file and not download it from the server (every time) if its being included on the browser end (which js is). All means faster page load times post initial load, and less bandwidth. If you include the JS file with php, every time you request the page the javascript will be pulled from your hard drive by php and sent back as a part of the server response (your end web page). I think given the nature and level of the original question, talking about the browser cache is only likely to confuse the poor chap. Jim: Ignore the browser cache for now and focus on learning the difference between javascript and PHP and which one should be used in what situations. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ On Fri, Apr 1, 2011 at 5:32 PM, Jim Giner jim.gi...@albanyhandball.comwrote: function. Try something like: ... echo 'heaading contains: scriptgetText(h2)/script'; ... I tried it - no better. -- 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] Newbie Question
{snip] ...stuff about tedd... [/snip] Thank goodness there is someone on the list much older than me. [snip] PS: It's not Friday yet. [/snip] It is now. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question
At 2:16 AM -0500 1/7/11, Daniel Brown wrote: On Thu, Jan 6, 2011 at 23:09, Bill Guion bgu...@comcast.net wrote: Fogging must be a REAL OLD Fashioned term. Please clarify. It was originally written before man invented the letter 'L', Bill. No, it was the predecessor to water-boarding. Cheers, tedd -- --- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question
On Fri, Jan 7, 2011 at 2:33 PM, tedd tedd.sperl...@gmail.com wrote: At 2:16 AM -0500 1/7/11, Daniel Brown wrote: On Thu, Jan 6, 2011 at 23:09, Bill Guion bgu...@comcast.net wrote: Fogging must be a REAL OLD Fashioned term. Please clarify. It was originally written before man invented the letter 'L', Bill. No, it was the predecessor to water-boarding. Only in cultural america. In other countries, it's still used as a public display of punishment and humiliation. And humiliation is beneficial to no one. And spankings never did me any good anyways:) Cheers, tedd -- --- http://sperling.com/ -- 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] Newbie Question
At 8:16 PM -0500 1/5/11, Daniel Brown wrote: On Wed, Jan 5, 2011 at 19:45, David Harkness davi...@highgearmedia.com wrote: [snip!] Most companies will gladly give their product away to put it in the hands of soon-to-be-professionals. :) Tedd had his chance to be professional back in the forties (the eighteen-forties, I believe). Now he teaches others who still have a chance. ;-P Which reminds me of an old thread from back in 2008, where I posted Tedd's senior class picture. You can see it here: http://links.parasane.net/tb46 Again, you got it wrong, o' wise one -- that's a picture of my son's senior class. I'm the one on the left fogging a smart-ass who refused to get out of my chariot's way. Boy, those were the good old days when I could flog a smart-ass. Cheers, tedd PS: It's not Friday yet. -- --- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question
At 11:37 AM -0500 01/06/11, tedd wrote: At 8:16 PM -0500 1/5/11, Daniel Brown wrote: On Wed, Jan 5, 2011 at 19:45, David Harkness davi...@highgearmedia.com wrote: [snip!] Most companies will gladly give their product away to put it in the hands of soon-to-be-professionals. :) Tedd had his chance to be professional back in the forties (the eighteen-forties, I believe). Now he teaches others who still have a chance. ;-P Which reminds me of an old thread from back in 2008, where I posted Tedd's senior class picture. You can see it here: http://links.parasane.net/tb46 Again, you got it wrong, o' wise one -- that's a picture of my son's senior class. I'm the one on the left fogging a smart-ass who refused to get out of my Fogging must be a REAL OLD Fashioned term. Please clarify. -= Bill =- chariot's way. Boy, those were the good old days when I could flog a smart-ass. Cheers, tedd PS: It's not Friday yet. -- --- http://sperling.com/ -- Don't find fault. Find a remedy. - Henry Ford -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question
On Thu, Jan 6, 2011 at 23:09, Bill Guion bgu...@comcast.net wrote: Fogging must be a REAL OLD Fashioned term. Please clarify. It was originally written before man invented the letter 'L', Bill. Welcome back, by the way. For someone who only posts once in a [great[ while, you certainly scrutinize spelling. -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question
At 9:36 PM -0300 1/1/11, Adolfo Olivera wrote: Hi, I'm new for php. Just trying to get my hello world going on godaddy hosting. Can't getting to work. I think sintax it's ok. I was understanding that my shared hosting plan had php installed. Any suggestions. Thanks, Happy 2011!! PS: Please, feel free to educate me on how to address the mailing list, since again, I'm new to php and not a regular user of mailing lists, I think it's the sintax -- that's usually left to governments -- try syntax instead. I agree with Ash to simply use .php as the file's suffix. While you could use .html, but it's usually hard for newbees to understand what's happening. So, create a file containing: ?php echo('Hello World'); ? and save it as myfile.php Then open your browser and put the url of the file in the address bar and you should see Hello World. If you don't, then post again. Cheers, tedd -- --- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question
At 7:43 PM -0600 1/2/11, Larry Garfield wrote: On Sunday, January 02, 2011 4:56:28 pm Adolfo Olivera wrote: Thanks for the replies. I'll just put a php on all my html containing php. A little of topic. Wich IDE are you guys using. I'm sort of in a catch twenty two here. I been alternating vim and dreamweaver. I'm trying to go 100% open source, but I really find dreamweaver easier to use so far. I bounce between NetBeans and Eclipse, depending on which currently sucks less. I have yet to find a PHP IDE that doesn't suck; it's just degrees of suckage. :-) --Larry Garfield Ain't that the truth. I use GoLive 9 without all the WYSIWYG nonsense -- DW can be used in the same fashion, but it's still bloatware. I teach using NetBeans, because it generally sucks less than Eclipse. Eclipse is simply too complicated and NetBeans tries to be less, but it's still too much. I really don't understand why someone can't make a simple good editor (php, css, javascript, html) with a file management system that shows both client and server side files. I always feel I am programming with one eye closed when using NetBeans. Cheers, tedd -- --- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question
On Wed, Jan 5, 2011 at 11:32, David Harkness davi...@highgearmedia.com wrote: I do have to say that NetBeans more than Eclipse will randomly become unusable for unknown reasons: disk and CPU activity spike, code-completion lags, whatever. Eclipse seems more solid in this regard. Whereas, on Linux, I've found the exact opposite to be true: NetBeans seemed to work fine, while Eclipse would lock. That said, I only use IDE's when I want to see what's new in the world, or to see if I could speed up my own development processes at all. Somehow, I always find myself back to vim, awk, sed, grep, and the like. With the exception of a few websites (Gmail usually, but not always, included), I spend my time on the command line, and have for years. GUI's, IDE's, RAD's, and so forth all have their place with some folks I just don't believe the place is with me. However, if for nothing else than to stay abreast of things, I'm going to have to check out PHPStorm. Until you mentioned it, I'd never even heard the name. -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question
On 11-01-05 01:35 PM, Daniel Brown wrote: On Wed, Jan 5, 2011 at 11:32, David Harknessdavi...@highgearmedia.com wrote: I do have to say that NetBeans more than Eclipse will randomly become unusable for unknown reasons: disk and CPU activity spike, code-completion lags, whatever. Eclipse seems more solid in this regard. Whereas, on Linux, I've found the exact opposite to be true: NetBeans seemed to work fine, while Eclipse would lock. That said, I only use IDE's when I want to see what's new in the world, or to see if I could speed up my own development processes at all. Somehow, I always find myself back to vim, awk, sed, grep, and the like. With the exception of a few websites (Gmail usually, but not always, included), I spend my time on the command line, and have for years. GUI's, IDE's, RAD's, and so forth all have their place with some folks I just don't believe the place is with me. However, if for nothing else than to stay abreast of things, I'm going to have to check out PHPStorm. Until you mentioned it, I'd never even heard the name. I'm with you on that. I'm still using a combination of terminals, joe, and various command-line tools. Whether I'm local or remote, all of the same tools are at my fingertips. In the few cases where I need to work in a Windows environment, I just mount the filesystem (for dev anyways) over NFS and proceed as usual :) Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question
On Wed, Jan 5, 2011 at 10:35 AM, Daniel Brown danbr...@php.net wrote: On Wed, Jan 5, 2011 at 11:32, David Harkness davi...@highgearmedia.com wrote: I do have to say that NetBeans more than Eclipse will randomly become unusable for unknown reasons: disk and CPU activity spike, code-completion lags, whatever. Eclipse seems more solid in this regard. Whereas, on Linux, I've found the exact opposite to be true: NetBeans seemed to work fine, while Eclipse would lock. I used Eclipse on Windows and only a short while on Ubuntu, and I've used NetBeans exclusively on Ubuntu. I actually switched to using the beta and now dev builds of NetBeans because of the issues I mentioned. To this day when I'm editing PHP files, the disk is hit with every keystroke. This doesn't happen for any other file type such as Java. There's no good reason that I can think of for that, and it's quite annoying. That said, I only use IDE's when I want to see what's new in the world, or to see if I could speed up my own development processes at all. There are so many helpful additions to modern IDEs that I miss when I drop into basic editors. The key is integration. When I'm editing a file, the IDE shows me which lines have been modified, added, and removed. I can hover over the indicator to see the original text or revert the change. You can get this information outside the editor, but I find it speeds up my work to have it in one place. Of course, I often find myself using grep instead of the IDE's find in files feature. ;) Old habits die hard. I will admit that I never got to be much of an emacs or vi power user, and I'd bet they have a lot of the IDE capabilities I have grown to love. I also have poor vision requiring larger fonts for the main text area, and most IDEs (GUIs really) provide more tools for me to mitigate the problem than a fixed terminal. David
Re: [PHP] Newbie Question
On Jan 4, 2011, at 5:27 AM, Steve Staples wrote: I now use Komodo (the free version) on my ubuntu workstation, and I love it... I dont know how I managed before. I use Komodo Edit on OS X and I love it as well, except for the compare files feature. It's the worst one I've ever used. TextWrangler is far superior for file comparisons. Marc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question
On Wed, Jan 5, 2011 at 3:05 PM, tedd tedd.sperl...@gmail.com wrote: I spent a couple of hours reviewing PHPStorm and it looks *very* promising! Thank you for sharing your thoughts on PHPStorm. My main performance gripe with NetBeans has lessened in the year I've been using it, so I'm less inclined to go up yet another learning curve, but it's always helpful to get input on the competitors. Please let us know if you end up using it in your class as I'm sure others will enjoy reading your findings. I spent about 10 minutes looking over the feature set of Komodo which was recommended by Steve Staples in this thread, and it also looks quite impressive. it's more expensive for the IDE (the stand-alone editor is free) which does remote file-syncing ($295), but you might be able to swing an educational discount with them. Most companies will gladly give their product away to put it in the hands of soon-to-be-professionals. :) Good luck! David
Re: [PHP] Newbie Question
On Wed, Jan 5, 2011 at 19:45, David Harkness davi...@highgearmedia.com wrote: [snip!] Most companies will gladly give their product away to put it in the hands of soon-to-be-professionals. :) Tedd had his chance to be professional back in the forties (the eighteen-forties, I believe). Now he teaches others who still have a chance. ;-P Which reminds me of an old thread from back in 2008, where I posted Tedd's senior class picture. You can see it here: http://links.parasane.net/tb46 -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question
On Sun, 2011-01-02 at 21:10 -0500, David McGlone wrote: On Sunday, January 02, 2011 08:43:51 pm Larry Garfield wrote: On Sunday, January 02, 2011 4:56:28 pm Adolfo Olivera wrote: Thanks for the replies. I'll just put a php on all my html containing php. A little of topic. Wich IDE are you guys using. I'm sort of in a catch twenty two here. I been alternating vim and dreamweaver. I'm trying to go 100% open source, but I really find dreamweaver easier to use so far. I bounce between NetBeans and Eclipse, depending on which currently sucks less. I have yet to find a PHP IDE that doesn't suck; it's just degrees of suckage. :-) I use Kate. It doesn't suck at all because it doesn't try to do the coding for you :-) -- Blessings David M. Personally, for the longest time I used EditPlus++ on windows... used it for about 4-5 years. I knew it, I liked it... then i got a job where they used ZEND (basically Eclipse yes?) I started to like it once i got the hang of it... but that job only lasted 3 weeks. ANYWAY... I now use Komodo (the free version) on my ubuntu workstation, and I love it... I dont know how I managed before. From my observations and experience, it's all about personal preferences. If the one you use works for you, and you like it, then use it. I caught flack for some time when I told people I used EditPlus ++ for all my coding, but they just didn't know how to use the features. Good luck with your coding! and finding an IDE that works for you! (or just a standard text editor like VI if you desire) Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question
On Sun, 2011-01-02 at 21:10 -0500, David McGlone wrote: On Sunday, January 02, 2011 08:43:51 pm Larry Garfield wrote: On Sunday, January 02, 2011 4:56:28 pm Adolfo Olivera wrote: Thanks for the replies. I'll just put a php on all my html containing php. A little of topic. Wich IDE are you guys using. I'm sort of in a catch twenty two here. I been alternating vim and dreamweaver. I'm trying to go 100% open source, but I really find dreamweaver easier to use so far. I bounce between NetBeans and Eclipse, depending on which currently sucks less. I have yet to find a PHP IDE that doesn't suck; it's just degrees of suckage. :-) I use Kate. It doesn't suck at all because it doesn't try to do the coding for you :-) -- Blessings David M. Kate is good for basic editing, but I use NetBeans for my main development, as I like the code hinting it gives you for your own class and function definitions. Incidentally, you can get Kate working on Windows if you install KDE on it, which I do at work. It gives me a setup similar to what I'm most used to at home with my Linux box. I'd avoid DreamWeaver whatever you do. Unless it's been severely improved recently, it's not a serious developers tool, more of an expensive hobbyists. It tries to hint and help too much, which really gets in the way when you're trying to write code and you know what you're doing! Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Newbie Question
On 1/2/2011 5:56 PM, Adolfo Olivera wrote: Thanks for the replies. I'll just put a php on all my html containing php. A little of topic. Wich IDE are you guys using. I'm sort of in a catch twenty two here. I been alternating vim and dreamweaver. I'm trying to go 100% open source, but I really find dreamweaver easier to use so far. While I may get shot for saying this - I wouldn't worry too much about being 100% open source. Use whatever gets the job done, period. If you're more comfortable with Dreamweaver, stick with Dreamweaver. In my day-to-day work I'll end up using a combination of Dreamweaver, Eclipse, and Notepad++, along with a little Pico/Nano to do quick edits on the server. I know a few people who swear by NetBeans, though I haven't felt the need to try yet another editor just now. I tend to prefer an editor that has code completion - sometimes makes for less typo mistakes and such, but that's just a personal preference, non-code completion is just as fine. Now, onto the real debate - editor color scheme and font choices! (Don't reply, I know better ... I just had to .)
Re: [PHP] Newbie Question
everyone I know who uses dreamweaver does so because the people that are supervising the project want to use dreamweaver, otherwise I haven't found anyone who actually liked using it. So I don't know if that actually means anything but that's the way it is. I guess it would be important to remember that as long as you clearly understand what you are doing it hardly matters whether you use notepad or something much more sophisticated, which also completes a bunch of tasks for you. I just went back and read the original post and realized the recent discussion has nothing to do with it. Awesome. On Mon, Jan 3, 2011 at 9:50 AM, Tim Thorburn immor...@nwconx.net wrote: On 1/2/2011 5:56 PM, Adolfo Olivera wrote: Thanks for the replies. I'll just put a php on all my html containing php. A little of topic. Wich IDE are you guys using. I'm sort of in a catch twenty two here. I been alternating vim and dreamweaver. I'm trying to go 100% open source, but I really find dreamweaver easier to use so far. While I may get shot for saying this - I wouldn't worry too much about being 100% open source. Use whatever gets the job done, period. If you're more comfortable with Dreamweaver, stick with Dreamweaver. In my day-to-day work I'll end up using a combination of Dreamweaver, Eclipse, and Notepad++, along with a little Pico/Nano to do quick edits on the server. I know a few people who swear by NetBeans, though I haven't felt the need to try yet another editor just now. I tend to prefer an editor that has code completion - sometimes makes for less typo mistakes and such, but that's just a personal preference, non-code completion is just as fine. Now, onto the real debate - editor color scheme and font choices! (Don't reply, I know better ... I just had to .) -- Mujtaba
Re: [PHP] Newbie Question
Tim, I've come to learn that relying on heavy and non free ides for developing can kick you in the rear when you have to setup your developement enviroment after a while. I've have that problem with some previous projects made with adobe flex, asp.net and sql 2008. That's the reason why I'm trying to go open source all the way. But I gotta say, I've been trying vim adding a few plugins and I'm having the hardest time getting the hang of it. I really miss dreamweaver, I hope the steep learning curve pays up later. El ene 3, 2011 11:50 a.m., Tim Thorburn immor...@nwconx.net escribió: On 1/2/2011 5:56 PM, Adolfo Olivera wrote: Thanks for the replies. I'll just put a php on all my... While I may get shot for saying this - I wouldn't worry too much about being 100% open source. Use whatever gets the job done, period. If you're more comfortable with Dreamweaver, stick with Dreamweaver. In my day-to-day work I'll end up using a combination of Dreamweaver, Eclipse, and Notepad++, along with a little Pico/Nano to do quick edits on the server. I know a few people who swear by NetBeans, though I haven't felt the need to try yet another editor just now. I tend to prefer an editor that has code completion - sometimes makes for less typo mistakes and such, but that's just a personal preference, non-code completion is just as fine. Now, onto the real debate - editor color scheme and font choices! (Don't reply, I know better ... I just had to .)
Re: [PHP] Newbie Question
On Mon, 2011-01-03 at 10:00 -0500, Mujtaba Arshad wrote: I just went back and read the original post and realized the recent discussion has nothing to do with it. Awesome. Yeah, that happens sometimes! The OP changed the subject this time, so it should be OK ;) Also, if you can avoid it, please try and avoid top-posting! Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Newbie Question
On Mon, Jan 03, 2011 at 12:03:41PM -0300, Adolfo Olivera wrote: Tim, I've come to learn that relying on heavy and non free ides for developing can kick you in the rear when you have to setup your developement enviroment after a while. I've have that problem with some previous projects made with adobe flex, asp.net and sql 2008. That's the reason why I'm trying to go open source all the way. But I gotta say, I've been trying vim adding a few plugins and I'm having the hardest time getting the hang of it. I really miss dreamweaver, I hope the steep learning curve pays up later. Vim's not for everyone. But here's the thing-- once you get it dialed in, your fingers never have to leave the main keys. Editing is way faster. And there are just a million key combinations to do things, only a fraction of which you will use. And those modes will drive you crazy for a while. I still get bitten by them, and I think every Vim user does. But again, it's way faster. Also, there's probably not a *nix server in the world which doesn't have Vi, Vim or the like installed. They may not have nano and they may not have emacs, but they will have Vi* installed. So your experience with Vim on the desktop translates into being able to operate on any *nix server. And there are Vim flavors for Windows as well, if you happen to be unfortunate enough to be running on an IIS machine. Paul -- Paul M. Foster http://noferblatz.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie Question
Add this to your .htaccess file and HTML files will be handled like PHP files allowing you put PHP in HTML files. AddType application/x-httpd-php .html Richard L. Buskirk -Original Message- From: Adolfo Olivera [mailto:olivera.ado...@gmail.com] Sent: Saturday, January 01, 2011 8:38 PM To: Joshua Kehn Cc: robl...@aapt.net.au; php-general@lists.php.net Subject: Re: [PHP] Newbie Question Sorry, here is the code. The .php extension is a requirement? Can't it b embedded on a .html file? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns= http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleUntitled Document/title /head body ?php $a = hello; $hello =Hello Everyone; echo $a; echo $hello; ? /body /html On Sat, Jan 1, 2011 at 9:55 PM, Joshua Kehn josh.k...@gmail.com wrote: On Jan 1, 2011, at 7:50 PM, David Robley wrote: And normally would need to be saved as a .php file so the contents will be handled by php. Cheers -- David Robley A fool and his money are my two favourite people. Today is Boomtime, the 2nd day of Chaos in the YOLD 3177. Save the code as hello.php. Copy it to your root web directory (should be the base directory or something called public_html / www when you FTP in) and access it from youdomain.com/hello.php Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com -- Adolfo Olivera 15-3429-9743 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie Question
On Sun, 2011-01-02 at 11:48 -0500, ad...@buskirkgraphics.com wrote: Add this to your .htaccess file and HTML files will be handled like PHP files allowing you put PHP in HTML files. AddType application/x-httpd-php .html Richard L. Buskirk -Original Message- From: Adolfo Olivera [mailto:olivera.ado...@gmail.com] Sent: Saturday, January 01, 2011 8:38 PM To: Joshua Kehn Cc: robl...@aapt.net.au; php-general@lists.php.net Subject: Re: [PHP] Newbie Question Sorry, here is the code. The .php extension is a requirement? Can't it b embedded on a .html file? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns= http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleUntitled Document/title /head body ?php $a = hello; $hello =Hello Everyone; echo $a; echo $hello; ? /body /html On Sat, Jan 1, 2011 at 9:55 PM, Joshua Kehn josh.k...@gmail.com wrote: On Jan 1, 2011, at 7:50 PM, David Robley wrote: And normally would need to be saved as a .php file so the contents will be handled by php. Cheers -- David Robley A fool and his money are my two favourite people. Today is Boomtime, the 2nd day of Chaos in the YOLD 3177. Save the code as hello.php. Copy it to your root web directory (should be the base directory or something called public_html / www when you FTP in) and access it from youdomain.com/hello.php Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com -- Adolfo Olivera 15-3429-9743 It's really best not to think about embedding PHP in an HTML file, as that isn't really how it works and it just encourages bad practices. HTML is embedded inside PHP files, not the other way around. The PHP parser interprets all the PHP code and creates the necessary output, and passes that output along with any HTML to the web server to then deliver to the client (browser). If you embedded PHP inside HTML files, the web server would have to call up the PHP parser every time you broke in and out of PHP tags, which wouldn't do at all! I wouldn't recommend having .html parsed as PHP though, as it will slow down your website/application unnecessarily for any .html files that contain no PHP code, as PHP still has to parse the file for any code, even if there is none. Leave .html files for static pages that you produce with a PHP app for example, or use MOD_REWRITE to reference PHP scripts when certain .html files are requested by the browser, as this can be a whole lot more specific and selective and won't introduce problems later on. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Newbie Question
On Jan 2, 2011, at 11:48 AM, ad...@buskirkgraphics.com wrote: Add this to your .htaccess file and HTML files will be handled like PHP files allowing you put PHP in HTML files. AddType application/x-httpd-php .html Richard L. Buskirk I would not recommend this approach, some perfectly valid reasons given by Ash. It's the wrong mindset to have. Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com
RE: [PHP] Newbie Question
The question was The .php extension is a requirement? The answer is no. While me and Ash may completely disagree on the php parser, the simple answer is there are many ways around running a non .php extension file in php. mod_rewrite rules in .htaccess files are interpreted for each request and CAN slow down things if your traffic is high. Having said that, mod_rewrite in httpd.conf is faster because it is compiled at server restart and it is native to the server. As a beginner, I completely agree with ash on bad practice rule of thumb. You will simply rewrite the html file later on wishing you had never did the hack to make it function. Richard L. Buskirk -Original Message- From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: Sunday, January 02, 2011 12:16 PM To: ad...@buskirkgraphics.com Cc: 'Adolfo Olivera'; 'Joshua Kehn'; robl...@aapt.net.au; php-general@lists.php.net Subject: RE: [PHP] Newbie Question On Sun, 2011-01-02 at 11:48 -0500, ad...@buskirkgraphics.com wrote: Add this to your .htaccess file and HTML files will be handled like PHP files allowing you put PHP in HTML files. AddType application/x-httpd-php .html Richard L. Buskirk -Original Message- From: Adolfo Olivera [mailto:olivera.ado...@gmail.com] Sent: Saturday, January 01, 2011 8:38 PM To: Joshua Kehn Cc: robl...@aapt.net.au; php-general@lists.php.net Subject: Re: [PHP] Newbie Question Sorry, here is the code. The .php extension is a requirement? Can't it b embedded on a .html file? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns= http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleUntitled Document/title /head body ?php $a = hello; $hello =Hello Everyone; echo $a; echo $hello; ? /body /html On Sat, Jan 1, 2011 at 9:55 PM, Joshua Kehn josh.k...@gmail.com wrote: On Jan 1, 2011, at 7:50 PM, David Robley wrote: And normally would need to be saved as a .php file so the contents will be handled by php. Cheers -- David Robley A fool and his money are my two favourite people. Today is Boomtime, the 2nd day of Chaos in the YOLD 3177. Save the code as hello.php. Copy it to your root web directory (should be the base directory or something called public_html / www when you FTP in) and access it from youdomain.com/hello.php Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com -- Adolfo Olivera 15-3429-9743 It's really best not to think about embedding PHP in an HTML file, as that isn't really how it works and it just encourages bad practices. HTML is embedded inside PHP files, not the other way around. The PHP parser interprets all the PHP code and creates the necessary output, and passes that output along with any HTML to the web server to then deliver to the client (browser). If you embedded PHP inside HTML files, the web server would have to call up the PHP parser every time you broke in and out of PHP tags, which wouldn't do at all! I wouldn't recommend having .html parsed as PHP though, as it will slow down your website/application unnecessarily for any .html files that contain no PHP code, as PHP still has to parse the file for any code, even if there is none. Leave .html files for static pages that you produce with a PHP app for example, or use MOD_REWRITE to reference PHP scripts when certain .html files are requested by the browser, as this can be a whole lot more specific and selective and won't introduce problems later on. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question
On Jan 2, 2011, at 12:50 PM, ad...@buskirkgraphics.com wrote: The question was The .php extension is a requirement? The answer is no. While me and Ash may completely disagree on the php parser, the simple answer is there are many ways around running a non .php extension file in php. mod_rewrite rules in .htaccess files are interpreted for each request and CAN slow down things if your traffic is high. Having said that, mod_rewrite in httpd.conf is faster because it is compiled at server restart and it is native to the server. As a beginner, I completely agree with ash on bad practice rule of thumb. You will simply rewrite the html file later on wishing you had never did the hack to make it function. Richard L. Buskirk Sorry, here is the code. The .php extension is a requirement? Can't it b embedded on a .html file? _This_ question when asked from a beginner requires a non-confusing answer of yes. Can't it be embedded on a .html file? PHP is always embedded alongside HTML code within ?php ? tags. It's not embedded inside a .html file as the extension should indicate the file type. Adding a mod_rewrite rule (as you suggest) can lead to confusion later on in development. At the very least you'll look stupid re-asking Can't it be embedded... Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com
Re: [PHP] Newbie Question
On Sun, Jan 2, 2011 at 12:16 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Sun, 2011-01-02 at 11:48 -0500, ad...@buskirkgraphics.com wrote: Add this to your .htaccess file and HTML files will be handled like PHP files allowing you put PHP in HTML files. AddType application/x-httpd-php .html I wouldn't recommend having .html parsed as PHP though, as it will slow down your website/application unnecessarily for any .html files that contain no PHP code, as PHP still has to parse the file for any code, even if there is none. Leave .html files for static pages that you produce with a PHP app for example, or use MOD_REWRITE to reference PHP scripts when certain .html files are requested by the browser, as this can be a whole lot more specific and selective and won't introduce problems later on. I tend to disagree with Ashley on this topic. For many websites, I'll start out making all pages .php, even if they don't require PHP at the moment. That's for a couple reasons. 1) A few years back, there was certainly a significant performance advantage to keeping essentially static pages html. However, in my current benchmarking (using both siege and ab on my Ubuntu servers using apache with mod_php), if I use a cache such as APC and a well-configured apache server, PHP tends to perform just as well (or sometimes even better) than the html version. Rasmus has demonstrated similar performance results: http://talks.php.net/show/froscon08/24 2) I don't want to have to change urls site-wide and set up redirects from the old url whenever a page requires adding dynamic capabilities. By making all pages PHP right from the beginning, adding dynamic capabilities is a snap as I just add the functionality. Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com
Re: [PHP] Newbie Question
On Jan 2, 2011, at 1:17 PM, Adam Richardson wrote: I tend to disagree with Ashley on this topic. For many websites, I'll start out making all pages .php, even if they don't require PHP at the moment. That's for a couple reasons. 1) A few years back, there was certainly a significant performance advantage to keeping essentially static pages html. However, in my current benchmarking (using both siege and ab on my Ubuntu servers using apache with mod_php), if I use a cache such as APC and a well-configured apache server, PHP tends to perform just as well (or sometimes even better) than the html version. Rasmus has demonstrated similar performance results: http://talks.php.net/show/froscon08/24 2) I don't want to have to change urls site-wide and set up redirects from the old url whenever a page requires adding dynamic capabilities. By making all pages PHP right from the beginning, adding dynamic capabilities is a snap as I just add the functionality. Adam I agree starting with all .php files is good practice for basic sites. I recommend for applications and bigger then basic project using a decent framework or main routing file to handle routes for you, instead of requiring you to manually adjust them if something changes. Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question
Thanks for the replies. I'll just put a php on all my html containing php. A little of topic. Wich IDE are you guys using. I'm sort of in a catch twenty two here. I been alternating vim and dreamweaver. I'm trying to go 100% open source, but I really find dreamweaver easier to use so far. El ene 2, 2011 3:25 p.m., Joshua Kehn josh.k...@gmail.com escribió: On Jan 2, 2011, at 1:17 PM, Adam Richardson wrote: I tend to disagree with Ashley on this topic... I agree starting with all .php files is good practice for basic sites. I recommend for applications and bigger then basic project using a decent framework or main routing file to handle routes for you, instead of requiring you to manually adjust them if something changes. Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshu... PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question
On Jan 2, 2011, at 5:56 PM, Adolfo Olivera wrote: Thanks for the replies. I'll just put a php on all my html containing php. A little of topic. Wich IDE are you guys using. I'm sort of in a catch twenty two here. I been alternating vim and dreamweaver. I'm trying to go 100% open source, but I really find dreamweaver easier to use so far. I use VIM and TextMate exclusively. Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com
Re: [PHP] Newbie Question
On Sunday, January 02, 2011 4:56:28 pm Adolfo Olivera wrote: Thanks for the replies. I'll just put a php on all my html containing php. A little of topic. Wich IDE are you guys using. I'm sort of in a catch twenty two here. I been alternating vim and dreamweaver. I'm trying to go 100% open source, but I really find dreamweaver easier to use so far. I bounce between NetBeans and Eclipse, depending on which currently sucks less. I have yet to find a PHP IDE that doesn't suck; it's just degrees of suckage. :-) --Larry Garfield -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question
On Sunday, January 02, 2011 08:43:51 pm Larry Garfield wrote: On Sunday, January 02, 2011 4:56:28 pm Adolfo Olivera wrote: Thanks for the replies. I'll just put a php on all my html containing php. A little of topic. Wich IDE are you guys using. I'm sort of in a catch twenty two here. I been alternating vim and dreamweaver. I'm trying to go 100% open source, but I really find dreamweaver easier to use so far. I bounce between NetBeans and Eclipse, depending on which currently sucks less. I have yet to find a PHP IDE that doesn't suck; it's just degrees of suckage. :-) I use Kate. It doesn't suck at all because it doesn't try to do the coding for you :-) -- Blessings David M. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie Question
Hi, I'm new for php. Just trying to get my hello world going on godaddy hosting. Can't getting to work. I think sintax it's ok. I was understanding that my shared hosting plan had php installed. Any suggestions. Thanks, Happy 2011!! PS: Please, feel free to educate me on how to address the mailing list, since again, I'm new to php and not a regular user of mailing lists,
Re: [PHP] Newbie Question
On Jan 1, 2011, at 7:36 PM, Adolfo Olivera wrote: Hi, I'm new for php. Just trying to get my hello world going on godaddy hosting. Can't getting to work. I think sintax it's ok. I was understanding that my shared hosting plan had php installed. Any suggestions. Thanks, Happy 2011!! PS: Please, feel free to educate me on how to address the mailing list, since again, I'm new to php and not a regular user of mailing lists, Can you post the code that you are using? It should look something like the following: ?php echo Hello World!; ? Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question
Joshua Kehn wrote: On Jan 1, 2011, at 7:36 PM, Adolfo Olivera wrote: Hi, I'm new for php. Just trying to get my hello world going on godaddy hosting. Can't getting to work. I think sintax it's ok. I was understanding that my shared hosting plan had php installed. Any suggestions. Thanks, Happy 2011!! PS: Please, feel free to educate me on how to address the mailing list, since again, I'm new to php and not a regular user of mailing lists, Can you post the code that you are using? It should look something like the following: ?php echo Hello World!; ? And normally would need to be saved as a .php file so the contents will be handled by php. Cheers -- David Robley A fool and his money are my two favourite people. Today is Boomtime, the 2nd day of Chaos in the YOLD 3177. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question
On Jan 1, 2011, at 7:50 PM, David Robley wrote: And normally would need to be saved as a .php file so the contents will be handled by php. Cheers -- David Robley A fool and his money are my two favourite people. Today is Boomtime, the 2nd day of Chaos in the YOLD 3177. Save the code as hello.php. Copy it to your root web directory (should be the base directory or something called public_html / www when you FTP in) and access it from youdomain.com/hello.php Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com
Re: [PHP] Newbie Question
Sorry, here is the code. The .php extension is a requirement? Can't it b embedded on a .html file? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns= http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleUntitled Document/title /head body ?php $a = hello; $hello =Hello Everyone; echo $a; echo $hello; ? /body /html On Sat, Jan 1, 2011 at 9:55 PM, Joshua Kehn josh.k...@gmail.com wrote: On Jan 1, 2011, at 7:50 PM, David Robley wrote: And normally would need to be saved as a .php file so the contents will be handled by php. Cheers -- David Robley A fool and his money are my two favourite people. Today is Boomtime, the 2nd day of Chaos in the YOLD 3177. Save the code as hello.php. Copy it to your root web directory (should be the base directory or something called public_html / www when you FTP in) and access it from youdomain.com/hello.php Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com -- Adolfo Olivera 15-3429-9743
Re: [PHP] Newbie Question
On Jan 1, 2011, at 8:37 PM, Adolfo Olivera wrote: Sorry, here is the code. The .php extension is a requirement? Can't it b embedded on a .html file? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleUntitled Document/title /head body ?php $a = hello; $hello =Hello Everyone; echo $a; echo $hello; ? /body /html On Sat, Jan 1, 2011 at 9:55 PM, Joshua Kehn josh.k...@gmail.com wrote: On Jan 1, 2011, at 7:50 PM, David Robley wrote: And normally would need to be saved as a .php file so the contents will be handled by php. Cheers -- David Robley A fool and his money are my two favourite people. Today is Boomtime, the 2nd day of Chaos in the YOLD 3177. Save the code as hello.php. Copy it to your root web directory (should be the base directory or something called public_html / www when you FTP in) and access it from youdomain.com/hello.php Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com Yes it _can_ be embedded alongside HTML code, but it must have the .php extension otherwise it won't be picked up as a PHP file. You could add a .htaccess rule to change the processing directive (essentially make every HTML file a PHP file) but that would be wasteful if you ever serve straight HTML. Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com
Re: [PHP] newbie basic realm protection - why don't the input usr/pass stick?
you script looks (and works) fine. so i dont think the problem is in your script I found firebug/live http headers firefox addons to be helpful in this situation see if your client is actually sending Authorization Basic header Kranthi. http://goo.gl/e6t3 Kranthi, thanks for looking.. I did find out with the help of the host.. that the issue was because PHP was running in fastcgi mode instead of apache module mode. Now it is behaving as expected. -Govinda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie basic realm protection - why don't the input usr/pass stick?
Hi everyone I am hacking my way through something unrelated to this post.. but needed to stop and (real quick) pass-protect a page to use it to run some quick (*admin-only*) scripts on a shared host. ..and I see now how poor is my understanding of what seems like basic stuff. As a start for my quick understanding to pass protect a page, I used the Example #6 Basic HTTP Authentication example, from here: http://www.php.net/manual/en/features.http-auth.php ..which is just this: ?php if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm=My Realm'); header('HTTP/1.0 401 Unauthorized'); echo 'Text to send if user hits Cancel button'; exit; } else { echo pHello {$_SERVER['PHP_AUTH_USER']}./p; echo pYou entered {$_SERVER['PHP_AUTH_PW']} as your password./ p; } ? ..and no matter what i type in the authentication dialogue that pops up.. then after I submit it.. it just keeps looping forever popping up the dialogue.. I.e. I never get past the authenticate dialogue to see this line executed: echo pHello {$_SERVER['PHP_AUTH_USER']}./p; What am I missing? Thanks for your bothering to help with this, Govinda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie basic realm protection - why don't the input usr/pass stick?
you script looks (and works) fine. so i dont think the problem is in your script I found firebug/live http headers firefox addons to be helpful in this situation see if your client is actually sending Authorization Basic header Kranthi. http://goo.gl/e6t3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie looking for a project
tedd wrote: At 12:34 PM -0500 11/8/10, Daniel P. Brown wrote: On Mon, Nov 8, 2010 at 06:29, Ashim Kapoor ashimkap...@gmail.com wrote: Writing apps on my own is fun but it's fruit is only for me to benefit from,but yes if nothing else I should do that. Not at all, many others can benefit from it as well. Tedd's examples have been referenced on this list many times, and you can see them yourself: http://www.php1.net/ Just because you're developing the code to learn for yourself doesn't mean you can't put it in the public domain for others to do the same. Thanks for the plug, but let me add this. When you develop a demo for yourself, you can take liberties. However, when you release a demo for public/peer review, you had better know what you are doing and that makes you a better programmer. My advice, spend your time learning and helping others -- it will educate both. That's better advice than you may ever know Ashim ^ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie looking for a project
At 12:34 PM -0500 11/8/10, Daniel P. Brown wrote: On Mon, Nov 8, 2010 at 06:29, Ashim Kapoor ashimkap...@gmail.com wrote: Writing apps on my own is fun but it's fruit is only for me to benefit from,but yes if nothing else I should do that. Not at all, many others can benefit from it as well. Tedd's examples have been referenced on this list many times, and you can see them yourself: http://www.php1.net/ Just because you're developing the code to learn for yourself doesn't mean you can't put it in the public domain for others to do the same. -- /Daniel P. Brown Thanks for the plug, but let me add this. When you develop a demo for yourself, you can take liberties. However, when you release a demo for public/peer review, you had better know what you are doing and that makes you a better programmer. My advice, spend your time learning and helping others -- it will educate both. Cheers, tedd -- --- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie looking for a project
Dear Tedd, I have read one php book cover to cover, I wanted to contribute to projects for 2 reasons:- 1. Someone would benefit from the app. 2. I would learn more by interacting with experienced people. Writing apps on my own is fun but it's fruit is only for me to benefit from,but yes if nothing else I should do that. Many thanks for your time, Ashim. On Sun, Nov 7, 2010 at 8:21 PM, tedd tedd.sperl...@gmail.com wrote: At 3:39 PM +0530 11/7/10, Ashim Kapoor wrote: Dear All, I am a beginner looking for a project to contribute. Can someone tell me some good quality projects where I would learn the most? I hope this is the right forum for this query. Many thanks, Ashim Kapoor Hi Ashim: When I started programming php/mysql, I purchased as many books as I could and went through each one creating demos of everything I found. I still read at least one book every two weeks (or so my expense statement reads) and my demos have gotten more complex incorporating more than php/mysql (i.e., javascript, jquery, css, etc.) Now I have a considerable amount of demos and when I need something, I have a great store of example to draw on. Cheers, tedd -- --- http://sperling.com/
Re: [PHP] Newbie looking for a project
On Mon, Nov 8, 2010 at 06:29, Ashim Kapoor ashimkap...@gmail.com wrote: Writing apps on my own is fun but it's fruit is only for me to benefit from,but yes if nothing else I should do that. Not at all, many others can benefit from it as well. Tedd's examples have been referenced on this list many times, and you can see them yourself: http://www.php1.net/ Just because you're developing the code to learn for yourself doesn't mean you can't put it in the public domain for others to do the same. -- /Daniel P. Brown Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie looking for a project
Dear All, I am a beginner looking for a project to contribute. Can someone tell me some good quality projects where I would learn the most? I hope this is the right forum for this query. Many thanks, Ashim Kapoor
Re: [PHP] Newbie looking for a project
On Sun, 2010-11-07 at 15:39 +0530, Ashim Kapoor wrote: Dear All, I am a beginner looking for a project to contribute. Can someone tell me some good quality projects where I would learn the most? I hope this is the right forum for this query. Many thanks, Ashim Kapoor What most people do for their first projects is to build a website for themselves. This lets you learn what you want at the pace you want, and this list is always here to help! Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Newbie looking for a project
At 3:39 PM +0530 11/7/10, Ashim Kapoor wrote: Dear All, I am a beginner looking for a project to contribute. Can someone tell me some good quality projects where I would learn the most? I hope this is the right forum for this query. Many thanks, Ashim Kapoor Hi Ashim: When I started programming php/mysql, I purchased as many books as I could and went through each one creating demos of everything I found. I still read at least one book every two weeks (or so my expense statement reads) and my demos have gotten more complex incorporating more than php/mysql (i.e., javascript, jquery, css, etc.) Now I have a considerable amount of demos and when I need something, I have a great store of example to draw on. Cheers, tedd -- --- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie question about code
I'm looking at someone's code to learn and I'm relatively new to programming. In the code I see commands like: $code-do_command(); I'm not really sure what that means. How would that look in procedural style programming? do_command($code); or something else? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php