Re: [PHP] Netbeans IDE 6.5
James McLean wrote: I myself and I'm sure many others will agree that sticking to 'around' 80 chars is best-practice, it's handy for those times when you need to fix code in an emergency in an 80 col terminal, among other reasons. Personally the 80 col marker (I set it to 78 cols actually) is one of the first things I enable in Eclipse PDT.. I only use a character limit for email but I have a wide screen so write code to the edge of the screen. Updating code via a terminal connection is no problem either because vim will wrap long lines. So 80chars may have been a good idea a long time ago but I think that the rule is a bit outdated. -- John Those willing to give up a little liberty for a little security deserve neither security nor liberty. [Benjamin Franklin] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Textarea to road a text file
Jean Lee wrote: Could you explain what was my fault concerned about this case? " . $contents . ""; ?> As Andrew pointed out, you need to use htmlspecialchars() echo "" .htmlspecialchars($contents). ""; The reason for that is because the text may contain html control characters like <>&'" which the browser will attempt to interpret. http://php.net/htmlspecialchars I usually use htmlentities() instead http://de.php.net/manual/en/function.htmlentities.php -- John Those willing to give up a little liberty for a little security deserve neither security nor liberty. [Benjamin Franklin] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Netbeans IDE 6.5
Skip Evans wrote: Now, if I can just get rid of that red line at the 80 column mark. I haven't bothered with 80 columns since I wrote assembly on a terminal connected to a PDP-11 in college. Sorry forgot to include this. Tools=>Options=>Formatting Set Right Margin to 200 (200 is the largest number the field will accept) The red line should be gone now -- John Those willing to give up a little liberty for a little security deserve neither security nor liberty. [Benjamin Franklin] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Converting tables into forms
Apologies for semi-hijacking, but I am confused. What are aiming to do that something like PHPMyAdmin doesn't do? 2009/10/28 ben...@gmail.com > Jay, > > What function do you have? Thanks to everyone for their feedback. > > Best, > > Ben > > On Wed, Oct 28, 2009 at 9:17 AM, Jay Blanchard >wrote: > > > [snip]If your solution requires you to create hundreds of forms, which > > could > > take months to code, you need to take another look at the problem. I > > don't believe you have thought it through very well.[/snip] > > > > Actually you could use the function I provided to do this on the fly or > > have the function write out a file for each table involved. > > >
Re: [PHP] Netbeans IDE 6.5
On Thu, Oct 29, 2009 at 8:13 PM, John Black wrote: > James McLean wrote: >> >> I myself and I'm sure many others will agree that sticking to 'around' >> 80 chars is best-practice, it's handy for those times when you need to >> fix code in an emergency in an 80 col terminal, among other reasons. >> Personally the 80 col marker (I set it to 78 cols actually) is one of >> the first things I enable in Eclipse PDT.. > > I only use a character limit for email but I have a wide screen so write > code to the edge of the screen. > Updating code via a terminal connection is no problem either because vim > will wrap long lines. > So 80chars may have been a good idea a long time ago but I think that the > rule is a bit outdated. Personally I find wrapped vi/vim lines very annoying, hence why I stick to short lines where possible :) Cheers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Textarea to road a text file
[snip] . .. " . $contents . ""; ?> [/snip] Try http://us3.php.net/manual/en/function.file-get-contents.php " . $contents . ""; ?> I am unsure what you want to do here, display the menu in the textarea? Or do you want to be able to edit menu.php in the textarea? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Converting tables into forms
[snip]What are aiming to do that something like PHPMyAdmin doesn't do?[/snip] The OP never really answered this, but I don't think you can use PHPMyAdmin to automate the generation of forms from every table in a database. You could use the function I supplied in a loop to read each table and spit out a form (either write a file or do it on the fly) for those tables. The original intent of my function was to never have to worry about table structure ever again, just read the table info and generate a form on the fly. Never would a form have to be hard coded again. The basis for this script was begun 10 years ago, the one I provided to the list was last updated in 2006 as a generic handler that really needed much more work. It could be used as a stand-alone function or as part of a class. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Converting tables into forms
Hi, > What are aiming to do that something like PHPMyAdmin doesn't do? Perhaps the forms are for users. And users being able to drop databases isn't my idea of a good time. And setting up and maintaining multiple database users is far too much work - I prefer not to provide the interface in the first place. -- Richard Heyes HTML5 graphing: RGraph - www.rgraph.net (updated 25th October) Lots of PHP and Javascript code - http://www.phpguru.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Create a screenshot of a website
From: Paul M Foster > On Wed, Oct 28, 2009 at 05:49:43PM -0200, Manuel Lemos wrote: >> on 10/28/2009 05:24 PM Robert Cummings said the following: >> > >> > It hurts my eyes to go on the phpclasses website. It's like someone >> > vomited tabs and links :| >> >> I have no clue why you felt the need to be so aggressive. >> >> Anyway, if you are that sensitive to design issues, why don't you >> participate in the contest to propose a better design instead of just >> complaining against the work that others do to help the PHP community? > Here's a free suggestion. You don't even have to give me a prize. You > know those random words which are underlined on that page, and when you > mouse over them, you get the random advertisement on a completely > unrelated subject, which also emits a *sound* on my computer? Get rid of > them completely. They are beyond annoying. I get that you need to make > money with this site, but those obnoxious ads are the exact opposite > wrong way to do it. When I first looked at the site, I did not see any of these problems. But then I took a look at the page source and quickly figured out I already have the solution. 1. Install Firefox. 2. Install the NoScript add-on. 3. Under NoScript options, clean out the default white list, removing all of the .com sites. 4. Still in the options, on the Embedded tab, forbid everything except iframes. But, then again, maybe you want to forbid iframes as well. Then, as you browse, decide where and when to allow these features. I always do it on a temporary basis per site, so they get disabled again each time I start up the browser. By the way, HTML Validator, another FF add-on I recommend every developer install, shows a number of warnings on that site, similar to 'line 115 column 1 - Warning: attribute "width" has invalid value "49.5%"'. (NOTE: If you are on Linux, the FF add-on site incorrectly states this add-on is not available. But when you go to the home site for the add-on, there are Linux versions to install.) Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Create a screenshot of a website
Bob McConnell wrote: By the way, HTML Validator, another FF add-on I recommend every developer install, shows a number of warnings on that site, similar to 'line 115 column 1 - Warning: attribute "width" has invalid value "49.5%"'. (NOTE: If you are on Linux, the FF add-on site incorrectly states this add-on is not available. But when you go to the home site for the add-on, there are Linux versions to install.) Excellent, thanks for the info. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Assignment in Conditional - How are they evaluated?
How is the following evaluated: [code] if ($data = somefunc()) ... [/code] Ignoring the 'assignment inside condition' arguments, is the return value of somefunc() assigned to $data, and then $data's value is evaluated (to true or false), or is the actual assignment tested (does the assignment fail, etc)? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Assignment in Conditional - How are they evaluated?
On Thu, 2009-10-29 at 13:58 +, Mark Skilbeck wrote: > How is the following evaluated: > > [code] > if ($data = somefunc()) ... > [/code] > > Ignoring the 'assignment inside condition' arguments, is the return > value of somefunc() assigned to $data, and then $data's value is > evaluated (to true or false), or is the actual assignment tested (does > the assignment fail, etc)? > I believe that it determines if the return value of somefunc() is non-false. It will have the added benefit then that you can use the return value afterwards if it was, for example, not true, but a string or something instead. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Assignment in Conditional - How are they evaluated?
On Thu, Oct 29, 2009 at 10:58 AM, Mark Skilbeck wrote: > How is the following evaluated: > > [code] > if ($data = somefunc()) ... > [/code] > > Ignoring the 'assignment inside condition' arguments, is the return value > of somefunc() assigned to $data, and then $data's value is evaluated (to > true or false), or is the actual assignment tested (does the assignment > fail, etc)? > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > The code is interpreted this way... $data = somefunc(); if ($data) -- Martin Scotta
Re: [PHP] Assignment in Conditional - How are they evaluated?
Ashley Sheridan wrote: On Thu, 2009-10-29 at 13:58 +, Mark Skilbeck wrote: How is the following evaluated: [code] if ($data = somefunc()) ... [/code] Ignoring the 'assignment inside condition' arguments, is the return value of somefunc() assigned to $data, and then $data's value is evaluated (to true or false), or is the actual assignment tested (does the assignment fail, etc)? I believe that it determines if the return value of somefunc() is non-false. It will have the added benefit then that you can use the return value afterwards if it was, for example, not true, but a string or something instead. I do this all the time... an example is the following: name(); } else { // Handle no current user. echo 'Anonymous'; } ?> Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] opposite of quotemeta ?
Hi, In my script I want the user to enter some html which is saved to a file, I've noticed that php rather cleverly escapes the speech marks, so: Google becomes: Google Is there some function which prevents or reverts this ? something similar to html_entities maybe? Many thanks! Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fwd: [PHP] Assignment in Conditional - How are they evaluated?
On Thu, Oct 29, 2009 at 11:11 AM, Robert Cummings wrote: > Ashley Sheridan wrote: > >> On Thu, 2009-10-29 at 13:58 +, Mark Skilbeck wrote: >> >> How is the following evaluated: >>> >>> [code] >>> if ($data = somefunc()) ... >>> [/code] >>> >>> Ignoring the 'assignment inside condition' arguments, is the return value >>> of somefunc() assigned to $data, and then $data's value is evaluated (to >>> true or false), or is the actual assignment tested (does the assignment >>> fail, etc)? >>> >>> >> >> I believe that it determines if the return value of somefunc() is >> non-false. It will have the added benefit then that you can use the >> return value afterwards if it was, for example, not true, but a string >> or something instead. >> > > I do this all the time... an example is the following: > > > if( ($user = get_current_user()) ) > { >// Yay, we have a user... do something. >echo $user->name(); > } > else > { >// Handle no current user. >echo 'Anonymous'; > } > > ?> > > Cheers, > Rob. > -- > http://www.interjinn.com > Application and Templating Framework for PHP > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > There is a situation when common-sense can fail... if( $a && $b = do_something() ) The problem here is the precedence between && and = The correct sentence will be... if( $a && ($b = do_something()) ) C coders knows this behaviour very well. cheers, Martin Scotta -- Martin Scotta
Re: [PHP] opposite of quotemeta ?
Hi Matthew, you might have magic quotes enabled in your PHP installation. Have a look at http://php.net/manual/de/security.magicquotes.php about that topic. If you want to unescape the string, use the stripslashes-function (http://php.net/stripslashes). Greetings from Germany Marc Matthew Croud wrote: > Hi, > > In my script I want the user to enter some html which is saved to a file, > I've noticed that php rather cleverly escapes the speech marks, so: > > Google > > becomes: > > Google > > Is there some function which prevents or reverts this ? something > similar to html_entities maybe? > > Many thanks! > Matt > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Assignment in Conditional - How are they evaluated?
On Thu, Oct 29, 2009 at 10:23 AM, Martin Scotta wrote: > On Thu, Oct 29, 2009 at 11:11 AM, Robert Cummings wrote: > >> Ashley Sheridan wrote: >> >>> On Thu, 2009-10-29 at 13:58 +, Mark Skilbeck wrote: >>> >>> How is the following evaluated: [code] if ($data = somefunc()) ... [/code] Ignoring the 'assignment inside condition' arguments, is the return value of somefunc() assigned to $data, and then $data's value is evaluated (to true or false), or is the actual assignment tested (does the assignment fail, etc)? >>> >>> I believe that it determines if the return value of somefunc() is >>> non-false. It will have the added benefit then that you can use the >>> return value afterwards if it was, for example, not true, but a string >>> or something instead. >>> >> >> I do this all the time... an example is the following: >> >> > >> if( ($user = get_current_user()) ) >> { >> // Yay, we have a user... do something. >> echo $user->name(); >> } >> else >> { >> // Handle no current user. >> echo 'Anonymous'; >> } >> >> ?> >> >> Cheers, >> Rob. >> -- >> http://www.interjinn.com >> Application and Templating Framework for PHP >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > There is a situation when common-sense can fail... > > if( $a && $b = do_something() ) > > The problem here is the precedence between && and = > The correct sentence will be... > > if( $a && ($b = do_something()) ) > > C coders knows this behaviour very well. > > cheers, > Martin Scotta > > > > -- > Martin Scotta > Assignment operations in PHP have the "side effect" of returning the assignment. For example: function return_false() { return false; } var_dump(return_false()); //bool(false); var_dump($a = return_false()); //bool(false); var_dump($a = 1); // int(1) var_dump($a = "hello world!"); //string... So the same thing that allows you to do: $a = $b = $c = $d = 154; which works because "$d = 154" returns 154, which is assigned to $c, which returns 154... is how assignment in conditionals or looping works: if($a = return_false()) { } var_dump($a); //bool(false) if($a = "hello") {} var_dump($a); //string, "hello" So what's really happening is the return value of the expression "$a = " is evaluated and that's used to determine the truth of the conditionality. if($a = return_false()) is exactly the same thing as if(return_false()) save for you "capture" the output of the function, rather than just allow the conditional operator to see it. It's functionally equivalent to $a = return_false(); if($a) {} but it's important to understand that __assigning a variable to a value in PHP is an expression with a return value___ and that return value is the value that you assigned to the variable. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: UrlRewrite htaccess confusion
Rob Gould wrote: > I feel like I'm really close to a solution for the clean-url method in > htaccess. I've successfully got it now so that: > > http://benchwarmersports.com/packages/basketball/2010/nba-all-star-game > > maps to: > > http://benchwarmersports.com/packages.php?category=basketball&year=2010&title=nba-all-star-game > > > However, I'm finding that when I click on subsequent links from: > > http://benchwarmersports.com/packages/basketball/2010/nba-all-star-game > > that I land in a strange url-structure where it replicates the packages > part of the url. > > Can someone tell me what I might need to change about my rewrite logic > to fix this issue? I'm getting lost in the world of base urls and > recursive rewrites... > It's hard to tell without seeing the link and/or what code you use to generate it, but off the top of my head I would say that it's not a rewrite issue. It seems to be an issue with using relative URLs in your links. If you are on this page (this is in your browser address bar): http://benchwarmersports.com/packages.php?category=basketball&year=2010&title=nba-all-star-game The browser will interpret all relative links like 'somefile.php' as: http://benchwarmersports.com/somefile.php But if you use your rewritten URL, then the browser will see relative links as one of the following (not sure which without testing): http://benchwarmersports.com/packages/basketball/2010/nba-all-star-game/somefile.php --or-- http://benchwarmersports.com/packages/basketball/2010/somefile.php This is because it is interpreting the slashes as path separators. You probably need to generate absolute URLs in your links. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ... stop header("Location...) from working? [SOLVED]
At 7:31 PM -0400 10/27/09, tedd wrote: Hi gang: I just had a script stop following this statement: header("Location:users.php"); It *was* working, but now instead of running "users.php", it defaults to the parent script. When I place exit() after it, such as: header("Location:users.php"); exit(); The script simply exits. It does not continue to users.php -- BUT -- it did. What would stop this statement from working? Thanks, tedd To all: Okay, I found the problem. The directory that contained the above script had a .htaccess file that required authorization before running any script in that directory -- and -- that authorization script had a trailing space. As it turned out, there was nothing wrong with the script I was working on and thus my confusion as to why it stopped working. It simply stopped working because the authorization script in the directory had been changed. Many thanks to all who contributed. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What PHP version are you using?
Hi Guys, I just want to conduct a quick survey to find out what version of PHP people are using in their production environments. I have a PHP extension for Solr that I have set the minimum required version as 5.2.11. http://pecl.php.net/package/solr/ However, most of the PHP users that want to use it are unable to do so because the PHP version in the PROD environments is below 5.2.11 They are also nervous about upgrading to newer versions as it will require some regression testing. In my production environment I am using 5.3.0 and most of the people that I have contacted seems to be running 5.2.10 When I released the extension, I did all my regression tests against PHP 5.2.11 and now I am considering doing regression tests against 5.2.4 (released 30 August 2007) and newer versions so that I can set the minimum required version to 5.2.4 in order to accommodate more people. I cannot go below 5.2.0 though but I am thinking about starting at 5.2.4 and newer. I would really appreciate some feedback as it will be useful in helping me determine which PHP version numbers to do my regression tests against. Thanks. -- "Good Enough" is not good enough. To give anything less than your best is to sacrifice the gift. Quality First. Measure Twice. Cut Once.
[PHP] Catalog APP
Hello All, Has anyone used a good catalog app ? ( sort of like a shopping cart, but to show off products and not sell them ) Hopefully something with templates so we can tweak the look easily. Thanks! Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Catalog APP
Hello All, Has anyone used a good catalog app ? ( sort of like a shopping cart, but to show off products and not sell them ) Hopefully something with templates so we can tweak the look easily. Thanks! Jack Thanks! Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What PHP version are you using?
5.2.8, but testing 5.3 in local environment.
Re: [PHP] What PHP version are you using?
On Thu, Oct 29, 2009 at 11:15 AM, Fernando Castillo Aparicio < f_c_a_1...@yahoo.es> wrote: > 5.2.8, but testing 5.3 in local environment. > > Thanks Fernando. -- "Good Enough" is not good enough. To give anything less than your best is to sacrifice the gift. Quality First. Measure Twice. Cut Once.
[PHP] Re: UrlRewrite htaccess confusion
You are indeed correct! Absolute URLs for everything, images, css, javascript, and links fixed the issue. Took me forever to change every link in the whole site, but it's happy now. Seems like there ought to be an easier way. On Oct 29, 2009, at 10:52 AM, Shawn McKenzie wrote: Rob Gould wrote: I feel like I'm really close to a solution for the clean-url method in htaccess. I've successfully got it now so that: http://benchwarmersports.com/packages/basketball/2010/nba-all-star-game maps to: http://benchwarmersports.com/packages.php?category=basketball&year=2010&title=nba-all-star-game However, I'm finding that when I click on subsequent links from: http://benchwarmersports.com/packages/basketball/2010/nba-all-star-game that I land in a strange url-structure where it replicates the packages part of the url. Can someone tell me what I might need to change about my rewrite logic to fix this issue? I'm getting lost in the world of base urls and recursive rewrites... It's hard to tell without seeing the link and/or what code you use to generate it, but off the top of my head I would say that it's not a rewrite issue. It seems to be an issue with using relative URLs in your links. If you are on this page (this is in your browser address bar): http://benchwarmersports.com/packages.php?category=basketball&year=2010&title=nba-all-star-game The browser will interpret all relative links like 'somefile.php' as: http://benchwarmersports.com/somefile.php But if you use your rewritten URL, then the browser will see relative links as one of the following (not sure which without testing): http://benchwarmersports.com/packages/basketball/2010/nba-all-star-game/somefile.php --or-- http://benchwarmersports.com/packages/basketball/2010/somefile.php This is because it is interpreting the slashes as path separators. You probably need to generate absolute URLs in your links. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What PHP version are you using?
Israel Ekpo wrote: I would really appreciate some feedback as it will be useful in helping me determine which PHP version numbers to do my regression tests against. 5.2.0 to 5.2.11 depending on server. I'm not yet ready to move to 5.3.0 due to lack of stable support from the accelerators thus far (at least for the ones I frequent). Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Create a screenshot of a website
At 9:24 AM -0400 10/29/09, Robert Cummings wrote: Bob McConnell wrote: By the way, HTML Validator, another FF add-on I recommend every developer install, shows a number of warnings on that site, similar to 'line 115 column 1 - Warning: attribute "width" has invalid value "49.5%"'. (NOTE: If you are on Linux, the FF add-on site incorrectly states this add-on is not available. But when you go to the home site for the add-on, there are Linux versions to install.) Excellent, thanks for the info. Cheers, Rob. Rob: I just bookmark the following in my browser: javascript:void(document.location='http://validator.w3.org/check?uri='+document.location) Then when I want to validate anything, I just use that bookmark. Cheers, tedd PS: While I would not have said it like you did, but I agree with your opinion as to the web site. It is confusing as to what's what? Too much advertising, IMO. -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: UrlRewrite htaccess confusion
On Thu, 2009-10-29 at 11:26 -0400, Rob Gould wrote: > You are indeed correct! Absolute URLs for everything, images, css, > javascript, and links fixed the issue. Took me forever to change > every link in the whole site, but it's happy now. Seems like there > ought to be an easier way. > > > On Oct 29, 2009, at 10:52 AM, Shawn McKenzie wrote: > > > Rob Gould wrote: > >> I feel like I'm really close to a solution for the clean-url method > >> in > >> htaccess. I've successfully got it now so that: > >> > >> http://benchwarmersports.com/packages/basketball/2010/nba-all-star-game > >> > >> maps to: > >> > >> http://benchwarmersports.com/packages.php?category=basketball&year=2010&title=nba-all-star-game > >> > >> > >> However, I'm finding that when I click on subsequent links from: > >> > >> http://benchwarmersports.com/packages/basketball/2010/nba-all-star-game > >> > >> that I land in a strange url-structure where it replicates the > >> packages > >> part of the url. > >> > >> Can someone tell me what I might need to change about my rewrite > >> logic > >> to fix this issue? I'm getting lost in the world of base urls and > >> recursive rewrites... > >> > > > > It's hard to tell without seeing the link and/or what code you use to > > generate it, but off the top of my head I would say that it's not a > > rewrite issue. It seems to be an issue with using relative URLs in > > your > > links. If you are on this page (this is in your browser address bar): > > http://benchwarmersports.com/packages.php?category=basketball&year=2010&title=nba-all-star-game > > > > The browser will interpret all relative links like 'somefile.php' as: > > http://benchwarmersports.com/somefile.php > > > > But if you use your rewritten URL, then the browser will see relative > > links as one of the following (not sure which without testing): > > > > http://benchwarmersports.com/packages/basketball/2010/nba-all-star-game/somefile.php > > > > --or-- > > > > http://benchwarmersports.com/packages/basketball/2010/somefile.php > > > > This is because it is interpreting the slashes as path separators. > > You > > probably need to generate absolute URLs in your links. > > > > -- > > Thanks! > > -Shawn > > http://www.spidean.com > > There is, use the tag in your HTML. Don't forget that while you're rewriting the URLs, all the work is being done server-side. The browser thinks that the location of the document it is being served is in the path that the user typed into the location bar, so all relative links are relative to that. Thanks, Ash http://www.ashleysheridan.co.uk
RE: [PHP] Re: Create a screenshot of a website
From: tedd > At 9:24 AM -0400 10/29/09, Robert Cummings wrote: >>Bob McConnell wrote: >>>By the way, HTML Validator, another FF add-on I recommend every >>>developer install, shows a number of warnings on that site, similar to >>>'line 115 column 1 - Warning: attribute "width" has invalid value >>>"49.5%"'. (NOTE: If you are on Linux, the FF add-on site incorrectly >>>states this add-on is not available. But when you go to the home site >>>for the add-on, there are Linux versions to install.) >> >>Excellent, thanks for the info. >> >>Cheers, >>Rob. > > Rob: > > I just bookmark the following in my browser: > > javascript:void(document.location='http://validator.w3.org/check?uri='+d ocument.location) > > Then when I want to validate anything, I just use that bookmark. That doesn't work for servers inside our intranet, which are private and therefore not accessible outside our firewalls or VPNs. That would include all of our internal support, development and QA sites, as well as my family's servers within the family VPN. The HTML Validator add-on uses the same parsers as the w3c sites however. Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Create a screenshot of a website
tedd wrote: At 9:24 AM -0400 10/29/09, Robert Cummings wrote: Bob McConnell wrote: By the way, HTML Validator, another FF add-on I recommend every developer install, shows a number of warnings on that site, similar to 'line 115 column 1 - Warning: attribute "width" has invalid value "49.5%"'. (NOTE: If you are on Linux, the FF add-on site incorrectly states this add-on is not available. But when you go to the home site for the add-on, there are Linux versions to install.) Excellent, thanks for the info. Cheers, Rob. Rob: I just bookmark the following in my browser: javascript:void(document.location='http://validator.w3.org/check?uri='+document.location) Then when I want to validate anything, I just use that bookmark. I use the W3 validator all the time... but it's a pain in the rear cutting and pasting the page source when the content is behind a firewall or requires a user login. Additionally, some of the material I work with requires clearance and it would be a breach of security for me to paste it to a public site. If my evaluation of this plugin produces no issues then it will be useful in my day to day job and from what I see it is much MUCH more convenient than linking to the W3 site :) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What PHP version are you using?
At 11:10 AM -0400 10/29/09, Israel Ekpo wrote: Hi Guys, I just want to conduct a quick survey to find out what version of PHP people are using in their production environments. My version depends upon the client. I have one client who is still in version 4.3.1.0. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Create a screenshot of a website
At 11:40 AM -0400 10/29/09, Robert Cummings wrote: tedd wrote: At 9:24 AM -0400 10/29/09, Robert Cummings wrote: Bob McConnell wrote: By the way, HTML Validator, another FF add-on I recommend every developer install, shows a number of warnings on that site, similar to 'line 115 column 1 - Warning: attribute "width" has invalid value "49.5%"'. (NOTE: If you are on Linux, the FF add-on site incorrectly states this add-on is not available. But when you go to the home site for the add-on, there are Linux versions to install.) Excellent, thanks for the info. Cheers, Rob. Rob: I just bookmark the following in my browser: javascript:void(document.location='http://validator.w3.org/check?uri='+document.location) Then when I want to validate anything, I just use that bookmark. I use the W3 validator all the time... but it's a pain in the rear cutting and pasting the page source when the content is behind a firewall or requires a user login. Additionally, some of the material I work with requires clearance and it would be a breach of security for me to paste it to a public site. If my evaluation of this plugin produces no issues then it will be useful in my day to day job and from what I see it is much MUCH more convenient than linking to the W3 site :) Cheers, Rob. I see -- working from my environment is much simpler. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What PHP version are you using?
On Thu, Oct 29, 2009 at 11:47 AM, tedd wrote: > At 11:10 AM -0400 10/29/09, Israel Ekpo wrote: > >> Hi Guys, >> >> I just want to conduct a quick survey to find out what version of PHP >> people >> are using in their production environments. >> > > My version depends upon the client. I have one client who is still in > version 4.3.1.0. > > > Cheers, > > tedd > -- > --- > http://sperling.com http://ancientstones.com http://earthstones.com > Thanks guys. -- "Good Enough" is not good enough. To give anything less than your best is to sacrifice the gift. Quality First. Measure Twice. Cut Once.
Re: [PHP] What PHP version are you using?
5.2.11 here... Gr mrfroasty Israel Ekpo wrote: On Thu, Oct 29, 2009 at 11:47 AM, tedd wrote: At 11:10 AM -0400 10/29/09, Israel Ekpo wrote: Hi Guys, I just want to conduct a quick survey to find out what version of PHP people are using in their production environments. My version depends upon the client. I have one client who is still in version 4.3.1.0. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com Thanks guys. -- Extra details: OSS:Gentoo Linux profile:x86 Hardware:msi geforce 8600GT asus p5k-se location:/home/muhsin language(s):C/C++,VB,VHDL,bash,PHP,SQL,HTML,CSS Typo:40WPM url:http://www.mzalendo.net url:http://forums.mzalendo.net
Re: [PHP] What PHP version are you using?
2009/10/29 Israel Ekpo > Hi Guys, > > I just want to conduct a quick survey to find out what version of PHP > people > are using in their production environments. > > I have a PHP extension for Solr that I have set the minimum required > version > as 5.2.11. > [snip] > I cannot go below 5.2.0 though but I am thinking about starting at 5.2.4 > and > newer. > > I would really appreciate some feedback as it will be useful in helping me > determine which PHP version numbers to do my regression tests against. > > cat /etc/redhat-release Red Hat Enterprise Linux Server release 5.3 (Tikanga) > php -v PHP 5.1.6 (cli) (built: Feb 26 2009 07:01:12) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies > yum list php Loaded plugins: downloadonly, rhnplugin, security Excluding Packages in global exclude list Finished Installed Packages php.x86_64 5.1.6-23.2.el5_3 installed I wouldn't have thought this to be too uncommon. HTH
Re: [PHP] What PHP version are you using?
Like Israel it depends on the client I am doing several projects for a client now that the hosting company is still using 4.0.6 - and its been a headache. Most of the personal projects and many of my other clients are on 5.1 or higher. On Thu, Oct 29, 2009 at 12:22 PM, Tom Barrett wrote: > 2009/10/29 Israel Ekpo > > > Hi Guys, > > > > I just want to conduct a quick survey to find out what version of PHP > > people > > are using in their production environments. > > > > I have a PHP extension for Solr that I have set the minimum required > > version > > as 5.2.11. > > > [snip] > > > I cannot go below 5.2.0 though but I am thinking about starting at 5.2.4 > > and > > newer. > > > > I would really appreciate some feedback as it will be useful in helping > me > > determine which PHP version numbers to do my regression tests against. > > > > > cat /etc/redhat-release > Red Hat Enterprise Linux Server release 5.3 (Tikanga) > > > php -v > PHP 5.1.6 (cli) (built: Feb 26 2009 07:01:12) > Copyright (c) 1997-2006 The PHP Group > Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies > > > yum list php > Loaded plugins: downloadonly, rhnplugin, security > Excluding Packages in global exclude list > Finished > Installed Packages > php.x86_64 > 5.1.6-23.2.el5_3 > installed > > I wouldn't have thought this to be too uncommon. > > HTH >
Re: [PHP] What PHP version are you using?
On Thu, Oct 29, 2009 at 12:30 PM, Dan McCullough wrote: > Like Israel it depends on the client I am doing several projects for a > client now that the hosting company is still using 4.0.6 - and its been a > headache. Most of the personal projects and many of my other clients are > on > 5.1 or higher. > > On Thu, Oct 29, 2009 at 12:22 PM, Tom Barrett wrote: > > > 2009/10/29 Israel Ekpo > > > > > Hi Guys, > > > > > > I just want to conduct a quick survey to find out what version of PHP > > > people > > > are using in their production environments. > > > > > > I have a PHP extension for Solr that I have set the minimum required > > > version > > > as 5.2.11. > > > > > [snip] > > > > > I cannot go below 5.2.0 though but I am thinking about starting at > 5.2.4 > > > and > > > newer. > > > > > > I would really appreciate some feedback as it will be useful in helping > > me > > > determine which PHP version numbers to do my regression tests against. > > > > > > > > cat /etc/redhat-release > > Red Hat Enterprise Linux Server release 5.3 (Tikanga) > > > > > php -v > > PHP 5.1.6 (cli) (built: Feb 26 2009 07:01:12) > > Copyright (c) 1997-2006 The PHP Group > > Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies > > > > > yum list php > > Loaded plugins: downloadonly, rhnplugin, security > > Excluding Packages in global exclude list > > Finished > > Installed Packages > > php.x86_64 > > 5.1.6-23.2.el5_3 > > installed > > > > I wouldn't have thought this to be too uncommon. > > > > HTH > > > The internal Zend Engine version my extension was written for is 2.2.0 or newer. That is why I would not be able to go below 5.2.0, unfortunately. But so far, I appreciate your responses. Please keep it coming. -- "Good Enough" is not good enough. To give anything less than your best is to sacrifice the gift. Quality First. Measure Twice. Cut Once.
Re: [PHP] What PHP version are you using?
Tom Barrett wrote: 2009/10/29 Israel Ekpo Hi Guys, I just want to conduct a quick survey to find out what version of PHP people are using in their production environments. I have a PHP extension for Solr that I have set the minimum required version as 5.2.11. [snip] I cannot go below 5.2.0 though but I am thinking about starting at 5.2.4 and newer. I would really appreciate some feedback as it will be useful in helping me determine which PHP version numbers to do my regression tests against. cat /etc/redhat-release Red Hat Enterprise Linux Server release 5.3 (Tikanga) php -v PHP 5.1.6 (cli) (built: Feb 26 2009 07:01:12) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies yum list php Loaded plugins: downloadonly, rhnplugin, security Excluding Packages in global exclude list Finished Installed Packages php.x86_64 5.1.6-23.2.el5_3 installed I wouldn't have thought this to be too uncommon. I stand corrected... I also maintain a CentOS 5 system. I much prefer apt over yum though and so when the choice is mine I go with Debian. Debian 4 has PHP 5.2.0. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What PHP version are you using?
Israel Ekpo wrote: I would really appreciate some feedback as it will be useful in helping me determine which PHP version numbers to do my regression tests against. I used to write software for 4.1 and above but I am now dropping PHP 4 and will only write for PHP 5 and above. I would still write for PHP4 if someone would request a custom job but everything else will be 5. My dev machine is running PHP 5.3 with Suhosin-Patch (ARCH Linux) and my main server is currently running PHP 5.1 (CentOS 5) -- John Intelligent Life http://xkcd.com/638/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: UrlRewrite htaccess confusion
Rob Gould wrote: > You are indeed correct! Absolute URLs for everything, images, css, > javascript, and links fixed the issue. Took me forever to change every > link in the whole site, but it's happy now. Seems like there ought to > be an easier way. > There is an easier way. The logic depends upon your app, but create a function that builds and optionally echos URLs for you. It can work out the base url or you can do that when you initialize your app and define it as a constant. It can be as simple or as complex as you need. Something -- or -- echo 'Something'; -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: What PHP version are you using?
Israel Ekpo wrote: > Hi Guys, > > I just want to conduct a quick survey to find out what version of PHP people > are using in their production environments. > > I have a PHP extension for Solr that I have set the minimum required version > as 5.2.11. > > http://pecl.php.net/package/solr/ > > However, most of the PHP users that want to use it are unable to do so > because the PHP version in the PROD environments is below 5.2.11 > > They are also nervous about upgrading to newer versions as it will require > some regression testing. > > In my production environment I am using 5.3.0 and most of the people that I > have contacted seems to be running 5.2.10 > > When I released the extension, I did all my regression tests against PHP > 5.2.11 and now I am considering doing regression tests against 5.2.4 > (released 30 August 2007) and newer versions so that I can set the minimum > required version to 5.2.4 in order to accommodate more people. > > I cannot go below 5.2.0 though but I am thinking about starting at 5.2.4 and > newer. > > I would really appreciate some feedback as it will be useful in helping me > determine which PHP version numbers to do my regression tests against. > > Thanks. > Home/Dev: 5.2.15 Web: 5.1.6 (probably should update) -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: UrlRewrite htaccess confusion
Shawn McKenzie wrote: > Rob Gould wrote: >> You are indeed correct! Absolute URLs for everything, images, css, >> javascript, and links fixed the issue. Took me forever to change every >> link in the whole site, but it's happy now. Seems like there ought to >> be an easier way. >> > > There is an easier way. The logic depends upon your app, but create a > function that builds and optionally echos URLs for you. It can work out > the base url or you can do that when you initialize your app and define > it as a constant. It can be as simple or as complex as you need. > > Something > > -- or -- > > echo 'Something'; > Or the simplist approach is to define at constant at app initialization and use it: echo 'Something'; -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: What PHP version are you using?
Shawn McKenzie wrote: >> > Home/Dev: 5.2.15 > Web: 5.1.6 (probably should update) > O.K. so 5.2.15 doesn't exist :-( That is the Zend debugger version I have. I actually have Home/Dev: 5.2.4. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: UrlRewrite htaccess confusion
You can use a regexp for search and replace in your files. packages.php?category=([^&]+)&year=([^&]+)&title=([^&]+) The problem is those values are variables on the code. As Shawn said, it is easier to provide some function to create links.If you need to change all links you only change the function and the work is done. cheers, On Thu, Oct 29, 2009 at 2:31 PM, Shawn McKenzie wrote: > Shawn McKenzie wrote: > > Rob Gould wrote: > >> You are indeed correct! Absolute URLs for everything, images, css, > >> javascript, and links fixed the issue. Took me forever to change every > >> link in the whole site, but it's happy now. Seems like there ought to > >> be an easier way. > >> > > > > There is an easier way. The logic depends upon your app, but create a > > function that builds and optionally echos URLs for you. It can work out > > the base url or you can do that when you initialize your app and define > > it as a constant. It can be as simple or as complex as you need. > > > > Something > > > > -- or -- > > > > echo 'Something'; > > > > Or the simplist approach is to define at constant at app initialization > and use it: > > echo 'Something'; > > -- > Thanks! > -Shawn > http://www.spidean.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Martin Scotta
Re: [PHP] Re: UrlRewrite htaccess confusion
On Thu, Oct 29, 2009 at 12:26:10PM -0500, Shawn McKenzie wrote: > Rob Gould wrote: > > You are indeed correct! Absolute URLs for everything, images, css, > > javascript, and links fixed the issue. Took me forever to change every > > link in the whole site, but it's happy now. Seems like there ought to > > be an easier way. > > > > There is an easier way. The logic depends upon your app, but create a > function that builds and optionally echos URLs for you. It can work out > the base url or you can do that when you initialize your app and define > it as a constant. It can be as simple or as complex as you need. > > Something > > -- or -- > > echo 'Something'; +1 I initialize a "links" class from the config, and then use it to serve up link text and URLs depending on the parameters I give it. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] please help with regular expression in preg_replace
hello, im not a php developer, i just need to rewrite one php file but having problem with understanding syntax of regexp in php. i need to get domain name from fqdn (for example from $_SERVER['HTTP_HOST'] ) in sed its working well with "s/[^.]*\.//" , but preg_replace behaves weird. http_host is for example hostname.domain.com return "domain.com", but return only "com" i think when this php page get many hits, its not so wise to call sed everytime, i would like to ask someone for help how to write preg_replace pattern. thanx Rene
Re: [PHP] please help with regular expression in preg_replace
Hi Rene, This looks suspiciously like regex's "greedy" behaviour - it will gobble up everything that matches until you tell it otherwise. For example, your regex is matching "any character that isn't a dot, followed by a dot." In host.domain.com, both "host." and "domain." match this regex - and because your regex is "greedy" it's grabbing both, leaving you with "com". Try adding the "ungreedy" modifier to your regex, like so: $domain = preg_replace( '/[^.]*\./U' , '', $host); (note the additional U in your regex.) HTH, Andy On 29 October2009, at 20:33, Red wrote: hello, im not a php developer, i just need to rewrite one php file but having problem with understanding syntax of regexp in php. i need to get domain name from fqdn (for example from $_SERVER ['HTTP_HOST'] ) in sed its working well with "s/[^.]*\.//" , but preg_replace behaves weird. http_host is for example hostname.domain.com return "domain.com", but return only "com" i think when this php page get many hits, its not so wise to call sed everytime, i would like to ask someone for help how to write preg_replace pattern. thanx Rene -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] please help with regular expression in preg_replace
Red wrote: > hello, im not a php developer, i just need to rewrite one php file but having > problem with understanding syntax of regexp in php. > > i need to get domain name from fqdn (for example from $_SERVER['HTTP_HOST'] ) > > in sed its working well with "s/[^.]*\.//" , but preg_replace behaves weird. > > > http_host is for example hostname.domain.com > > $host = $_SERVER['HTTP_HOST']; > exec( "echo $host | sed s/[^.]*\.//", $domain ) ; > echo "$domain[0]" > ?> > > return "domain.com", but > > $host = $_SERVER['HTTP_HOST']; > $domain = preg_replace( '/[^.]*\./' , '', $host) ; > echo "$domain"; > ?> > > return only "com" > > i think when this php page get many hits, its not so wise to call sed > everytime, i would like to ask someone for help how to write preg_replace > pattern. > > thanx > > Rene > I would add one thing and change another. Adding an additional '^' to the start tells it to start at the beginning. And changing '*' to a '+' Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php