KBD

Keith Devens .com

Monday, October 13, 2008 Flag waving
REMEMBERS- HEEL BARES DURID! BARE DURIDS IS STORNG FREND! – Alamo

Archive: July 07, 2004

← July 05, 2004July 08, 2004 →

Daily link icon Wednesday, July 7, 2004

mod_rewrite, SCRIPT_NAME, and PATH_INFO

Argh, why isn't PATH_INFO set when using mod_rewrite? I have the following lines in my .htaccess file to make PHP pages be able to be served without the .php:

RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule . %{REQUEST_FILENAME}.php [L]

If my page is /foo.php and I visit it as /foo/bar, I expect SCRIPT_NAME to be /foo and PATH_INFO to be /bar. PATH_INFO isn't set, but if I visit the page as foo.php/bar it is. Also, SCRIPT_NAME points to the actual file location. So, if I visit the page as /foo/bar, SCRIPT_NAME is set to /foo.php and not /foo.

The net result of all this is that there's no way to split out the actual script name you requested from the PATH_INFO.

My only alternatives are using MultiViews, which does work as expected (though MultiViews has gotta be overkill just for this), and hard-coding the base path to the script in the script. And, even though the mod_rewrite documentation says the variables SCRIPT_URL and SCRIPT_URI should be set, they aren't.

Form tools (generators)

Form tools are like template systems. Everyone has their own way of doing it.

Here's a discussion over at php-tools.de about ASP.NET WebControls, PHP's HTML_QuickForm, and patForms (unfortunately, CVS only).

I'll have to take a look at all these sometime soon. patForms is the first one I've seen that almost builds a form model like my Formation does.

Woo, I can post again

I finally repaired my Formation library so that my login isn't broken anymore.

The library's finally getting into a shape I'm fairly happy with. The problem with frameworks is that >90% of the time they'll make your life significantly easier, but that extra <10% of the time they'll make your life much harder, and what you want to do might even be impossible within the framework. And it really sucks to have a framework that you've worked hard on that you have to not use because you couldn't make it do what you want.

The only thing you can do is keep trying to push that >90% higher and higher until it's "good enough". The other trick is to make it possible to use pieces of the framework without having to use the whole thing at once. That way, at least you can get some utility out of it even in cases where the whole thing isn't appropriate.

← July 05, 2004July 08, 2004 →
October 2008
SunMonTueWedThuFriSat
 1234
567891011
12131415161718
19202122232425
262728293031 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 7 posts

Recent comments XML

new⇒Spider solitaire

I have now won, at the "Difficult"​level, 186 games of Spider​Solitaire.  I...

75.179.28.113: Oct 13, 9:34am

new⇒Girls, please don't get breast implants

Please, don't marry him.

You​want to get surgery to make​yourself more i...

gigi: Oct 12, 11:47pm

I hate PHP

Elliot Anderson,

Dude!! You the​man! The reverse replacement for​array_u...

Alex Ndungu: Oct 11, 1:35am

Call a function from a string in Python

?!code:
some_object.__getattribute​__('method_name')()
?!/code

is​the s...

Patrick Corcoran: Oct 8, 3:53pm

Sed one-liners

Hi.

I wanted to let you know​that I wrote an article "Famous Sed​One-Lin...

Peteris Krumins: Oct 8, 3:05am

Timesheet Calculator

Hadn't seen it before now, but my​company already uses a time​tracking prog...

Keith: Oct 7, 10:44am

Generated in about 0.047s.

(Used 7 db queries)

mobile phone