KBD

Keith Devens .com

Tuesday, October 7, 2008 Flag waving
"It's like a condom; I'd rather have it and not need it than need it and not have... – some chick in Alien vs. Predator, when asked why she always carries a gun

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 4 posts

Recent comments XML

new⇒Timesheet Calculator

Have you also seen TSheets.com?...

Time Tracker: Oct 7, 2:00am

new⇒Girls, please don't get breast implants

Hey everyone, 

I am new to this​blog and I have enjoyed reading all​your...

Sarah.M.: Oct 6, 9:45am

obout inc - ASP.NET controls

I like there components. I've got​it to work locally on my pc.​However I'm ...

Jeff: Oct 2, 4:43pm

Dumb substring behavior in C# (and Java)

Yes, the Substring function is not​helpful when you hit the length​problem,...

Mike Irving: Oct 2, 7:56am

Generated in about 0.047s.

(Used 7 db queries)

mobile phone