Skip to main content.
home | support | download

Back to List Archive

Re: extracting title tag from file with phtml-extension

From: Ron Samuel Klatchko <rsk(at)not-real.brightmail.com>
Date: Wed Sep 08 1999 - 16:00:31 GMT
Eugen Dück wrote:
> Can I tell swish-e to also extract the title tag from files with the phtml-extension? It does not do that at the moment, and if I rename a .phtml-file to .html, I get the title tag. Using "PropertyNames title" also does not help.

Unfortunately, the extensions are not configurable although it's not
hard to modify the source code for this.  In fs.c, you can find a
function called ishtml():

int ishtml(filename)
char *filename;
{
        char *c, suffix[MAXSUFFIXLEN];
 
        c = (char *) strrchr(filename, '.');
 
        if (c == NULL)
                return 0;
        strcpy(suffix, c + 1);
        if (suffix[0] == '\0')
                return 0;
 
        if (!strncmp(suffix, "htm", 3))
                return 1;
        else if (!strncmp(suffix, "HTM", 3))
                return 1;
        else if (!strncmp(suffix, "shtml", 5))
                return 1;
        else if (!strncmp(suffix, "SHTML", 5))
                return 1;
        return 0;
}

The pattern should be fairly obvious.  To recognize files that have a
phtml extension, add the following lines just before the last return 0:

        else if (!strncmp(suffix, "phtml", 5))
                return 1;
        else if (!strncmp(suffix, "PHTML", 5))
                return 1;

Eventually, that function should be rewritten.  The list of extensions
should be configurable, it should use case insensitive compares, and the
strcpy should be removed since it doesn't add anything and is
technically buggy code.

moo
Received on Wed Sep 8 08:55:39 1999