getting Scamper to eat php

John Hinsley jhinsley at telinco.co.uk
Tue Aug 21 05:35:24 UTC 2001


Ned Konz wrote:
> 
> On Monday 20 August 2001 07:22 am, John Hinsley wrote:
> 
> > BTW, some of my most complex tables are generated as .php (through a MySQL
> > database): can anyone suggest a quick tweak to convince Scamper (or the
> > HTML Parser) to treat .php as .html? These would give a changeset a real
> > workout!
> 
> Who cares what the URL ends in? That's what the content-type http header is
> for... 

Well, I don't "really" care -- or I wouldn't if it worked! First, the
symptoms:

In Scamper I open up http://localhost (Apache running on this here Linux
box). I get the SuSE help stuff and a link to the the Apache
Documentation. All that works pretty much as expected. But over time
I've added links to the whopping great php manual (again, fine) and to
some php stuff I've done. These work OK in other browsers, but not in
Scamper. For example, I have a link to an front page for a database of
"Solicitors in Liverpool" (just in case, you understand!). The first
page of this link is plain old html, which Scamper parses fine. The
links are to php queries of a MySQL database, so they pop up as (for
example) http://localhost/emergency.php. Every other browser interprets
these fine. Scamper treats them as text: just as if I'd asked Konqueror
to show me the source.


>If Scamper actually looks at the so-called "extension" of the URL to
> determine content-type, it's broken.

But how does it "know" if a content type is valid? I've known this
completely throw Apache, as when I replaced php3 with php4. Peeking
about I found MIMEDocument and on the class side two MimeDatabases. 

extendedMIMEdatabase
	| d |
	(d _ self defaultMIMEdatabase)
	at: 'hqx' put: 'application/mac-binhex40';
	at: 'cpt' put: 'application/mac-compactpro';
	at: 'pdf' put: 'application/pdf';
	at: 'php' put: 'application/x-httpd-php .php'; "this is me, trying it
out!"
	at: 'ps' put: 'application/postscript';
	at: 'ai' put: 'application/postscript';
	at: 'eps' put: 'application/postscript';
	at: 'rtf' put: 'text/rtf';

//and so on.//

I've put in strictly Apache terms, as that's what the comment in
readMIMEdatabaseFrom: 
	"apache conf file format: mime.types"

seems to suggest. Maybe I need an entry as per


contentTypeHtml
	^'text/html'

But I've no idea what. (And I might be barking up the wrong tree, or
otherwise barking, anyway.)

Any ideas welcome (apart from re-doing it in asp!).

Cheers

John


-- 
Can't cope anymore? Desperate for help?
Join the 12 step program for those who yearn to give up Microsoft:
http://home.earthlink.net/~penguinrox/index.html




More information about the Squeak-dev mailing list