Re: [Nautilus-list] Viewing PHP files in Nautilus



On Tuesday, August 21, 2001, at 12:03  PM, D. D. Brierton wrote:

Is this a Nautilus issue or a gnome-vfs issue? If I've posted to the
wrong list could omeone forward this to the appropriate list and let me
know its address?

The gnome-vfs mailing list is at gnome-vfs lists ximian com
Nautilus has no default viewer for PHP files, not even a text view. It
also seems to give them the wrong mime type - they are classified as
application/x-php whereas I think they should be
application/x-httpd-php. (I'm using gnome-vfs 1.0.1 and nautilus 1.0.4.)

The tables that guess MIME types for local files are part of gnome-vfs. The entry for php says that any file with a .php, .php3, or .php4 extension should have MIME type of application/x-php (in gnome-vfs.mime) and any file that has the string "<?php" near the start of the file should have MIME type application/x-php (in gnome-vfs-mime-magic). It's simple to correct that if it's wrong. If application/x-httpd-php is the correct MIME type, we can switch to that. I'm not sure where the existing MIME type came from. Where can I find some reference information that documents this MIME type?

Normally, MIME types for this sort of file format are text/* MIME types, not application/* MIME types. One example of this is text/x-perl, but there are tons of others. That's how text viewers know how to display these types. Such viewers list text/* in the list of types they know how to handle. This list of MIME types is contained in the ".oaf.in" (name changing to ".server.in" for GNOME 2) file for each viewer, so we'd have to go around and edit each one. If we want to, we can teach each of the text viewers that it can also view this type -- even though it doesn't have a text/* MIME type, it's actually a text file.

The simplest solution would be to define a text/* MIME type for .php files,
since the application/* MIME types seem to be in error. This is practical if there's no important standard for the MIME types of .php source files already. But your message implies that there's an already existing application/x-httpd-php MIME type that is a standard that we'd benefit by following, so we might be out of luck.

Would it also be possible to have a mozilla view for (at least some) php
files? In the simplest case local files of the form:

/home/user/public_html/path/to/file.php

could map to:

http://localhost/~user/path/to/file.php

This kind of assumption about how a local web server corresponds to the local file system is beyond the scope of anything Nautilus currently does. I don't think it's a great idea to add it, but I can see how it would be handy for some people, and you might want to use a script to do this from Nautilus. In the case of a .php file, viewing through a web server is more like executing the file and looking at the output than like viewing the file itself. I can see how for many types of CGI files, it might be nice to see the view of the file through the web server. This doesn't seem specific to .php files.

    -- Darin




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]