Jump to content

s...html?


The Praetorian

Recommended Posts

Anyone know what the extension shtml means? I got this new script that requires my documents to have SSI turned on, but apparently it only works for documents with the extension shtml. Will this still work fine? It appears fine in my browser with that extension, and it seems to validate. I just want to make sure this will still work on other browsers...

Link to comment
Share on other sites

.shtml means it is an html file with serverside includes. Typically, the server is configured to parse .shtml files for serverside includes, although it can also be set to parse .html files the same way. I'm pretty sure all browsers can read it, as what is returned is still plain html, and the mime/media type is text/html.

Link to comment
Share on other sites

Wait.. does that mean I can do the same thing if I rename my php documents to sphp? Or will that not work? This code doesn't work on php pages as it is.. so..
I don't think so, there will be no engine that processes .sphp on the server i would think :)
Link to comment
Share on other sites

Can I see the script? I'm pretty sure you should be able to change the Apache SSI parts to PHP ssi, and so name your documents .php :)

Link to comment
Share on other sites

Ah. Gotcha. Here's that then.

#!/usr/bin/perl -w################################################## Meta Blaster Meta Tag Generator & Manager v1.0# Copyright © 2004 EliteCGI.COM#################################################use CGI::Carp qw(fatalsToBrowser);use Cwd;$dir = getcwd;&Get_Config;### Print Content Header Informationprint "Content-type: text/html\n\n";### Set Script Variables$webpage = $ENV{'REQUEST_URI'};@INDAT = split(/\?/,$webpage);if ($INDAT[0] =~ /\/$/){ $INDAT[0] = $INDAT[0] . $Config[1];}$INDAT[0] =~ s/\//%2F/g;$filemask = $dir . '/data/' . $INDAT[0] . '.dat';$| = 1;### Execute Page Lookup Function&Locate_Page();### Output Meta Tags for Page&Generate_Tags();# End Main Programend;################################################## Get script configuration data#################################################sub Get_Config{        my @TEMP;        my $hit;        open (CONFIG, "$dir/elite.cfg") || die "Can't open configuration file!\n";        @TEMP = <CONFIG>;        close (CONFIG);        foreach $hit(@TEMP)        {        chomp($hit);        @Config = split(/;/,$hit);}}################################################## Locate Page Function################################################## This function accesses the local database and # attempts to find the calling page. If the page# is located it loads the meta information from # the database. If the page can't be found then# the page is added to the database and default # meta tags are used initially.#################################################sub Locate_Page {if (-e "$filemask") {open(FHANDLE, "$filemask") || die "Cant open $filemask\n\n";$TAG_STATUS = <FHANDLE>;       #Are the meta tags default/custom 0/1 chomp ($TAG_STATUS);$META_TITLE = <FHANDLE>;       #The Page Tile chomp ($META_TITLE);$META_DESCRIPTION = <FHANDLE>; #Page Description chomp ($META_DESCRIPTION);$META_KEYWORDS = <FHANDLE>;    #Keywords chomp ($META_KEYWORDS);$META_ABSTRACT = <FHANDLE>;    #Abstract Description chomp ($META_ABSTRACT);$META_AUTHOR = <FHANDLE>;      #Author chomp ($META_AUTHOR);$META_COPYRIGHT = <FHANDLE>;   #Copyright Info chomp ($META_COPYRIGHT);$META_ROBOTS = <FHANDLE>;      #Robot Instructions chomp ($META_ROBOTS);$META_REVISIT = <FHANDLE>;     #Revisit Length chomp ($META_REVISIT);$META_DISTRO = <FHANDLE>;       #Distribution chomp ($META_DISTRO);$META_LANGUAGE = <FHANDLE>;     #Page Language chomp ($META_LANGUAGE);$META_LANGUAGE = substr ($META_LANGUAGE, 0, 2);$META_EXPIRES0 = <FHANDLE>;     #Page Expires chomp ($META_EXPIRES0);$META_EXPIRES1 = <FHANDLE>;     #Page Expires chomp ($META_EXPIRES1);$META_EXPIRES2 = <FHANDLE>;     #Page Expires chomp ($META_EXPIRES2);$META_EXPIRES3 = <FHANDLE>;     #Page Expires chomp ($META_EXPIRES3);$META_EXPIRES4 = <FHANDLE>;     #Page Expires chomp ($META_EXPIRES4);$META_REFRESH = <FHANDLE>;      #Refresh To... chomp ($META_REFRESH);$META_REFRESH_TIME = <FHANDLE>; #Refresh To... chomp ($META_REFRESH_TIME);$NO_CACHE = <FHANDLE>;          #Cache.. chomp ($NO_CACHE);close(FHANDLE);} else {   open (DEFAULT, "$dir/data/MB.DAT") || die "Default meta tag file can't be accessed\n\n";@DEFAULT_DATA = (<DEFAULT>);  close(DEFAULT);  open(FHANDLE, ">$filemask") || die "Cant create new page data file\n\n";     foreach $key (@DEFAULT_DATA){     chomp($key);     print FHANDLE"$key\n";}  close(FHANDLE);if ($cnt > 2){ print "Script loop error, terminating process."; exit; } $cnt++;&Locate_Page()}}################################################# Generate Tags Function################################################# This function correctly formats and outputs  # the meta tags for the calling page. ################################################sub Generate_Tags {if ($META_TITLE) { $META_TITLE = '<TITLE>' . $META_TITLE . "</TITLE>\n";}if ($META_DESCRIPTION) { $META_DESCRIPTION = '<META NAME="DESCRIPTION" CONTENT="' . $META_DESCRIPTION . "\">\n";}if ($META_KEYWORDS) { $META_KEYWORDS = '<META NAME="KEYWORDS" CONTENT="' . $META_KEYWORDS . "\">\n";}if ($META_ABSTRACT) { $META_ABSTRACT = '<META NAME="ABSTRACT" CONTENT="' . $META_ABSTRACT . "\">\n";}if ($META_AUTHOR) { $META_AUTHOR = '<META NAME="AUTHOR" CONTENT="' . $META_AUTHOR . "\">\n";}if ($META_COPYRIGHT) { $META_COPYRIGHT = '<META NAME="COPYRIGHT" CONTENT="' . $META_COPYRIGHT . "\">\n";}if ($META_ROBOTS) { $META_ROBOTS = '<META NAME="ROBOTS" CONTENT="' . $META_ROBOTS . "\">\n";}if ($META_REVISIT) { $META_REVISIT = '<META NAME="REVISIT-AFTER" CONTENT="' . $META_REVISIT . "\">\n";}if ($META_DISTRO) { $META_DISTRO = '<META NAME="DISTRIBUTION" CONTENT="' . $META_DISTRO . "\">\n";}if ($META_LANGUAGE) { $META_LANGUAGE = '<META HTTP-EQUIV="CONTENT-LANGUAGE" CONTENT="' . $META_LANGUAGE . "\">\n";}if ($META_EXPIRES0 && $META_EXPIRES1 && $META_EXPIRES2 && $META_EXPIRES3 && $META_EXPIRES4) { $META_EXPIRES =  "<META NAME=\"EXPIRES\" CONTENT=\"$META_EXPIRES0, $META_EXPIRES1 $META_EXPIRES2 $META_EXPIRES3 $META_EXPIRES4 GMT\">\n";}if ($META_REFRESH && $META_REFRESH_TIME) { $META_REFRESH = '<META HTTP-EQUIV="REFRESH" content="' . $META_REFRESH_TIME . ';URL=' . $META_REFRESH . "\">\n";}if ($NO_CACHE eq "On") { $NO_CACHE = '<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">' ."\n". '<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">' ."\n";}print $META_TITLE;print $META_DESCRIPTION;print $META_KEYWORDS;print $META_ABSTRACT;print $META_AUTHOR;print "<META NAME=\"GENERATOR\" CONTENT=\"(EliteCGI.com)[MetaBlaster V1.0]\">\n";print $META_COPYRIGHT;print $META_ROBOTS;print $META_REVISIT;print $META_DISTRO;print $META_LANGUAGE;print $META_EXPIRES;print $META_REFRESH;print $NO_CACHE;}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...