Question

Locked

SSIS Printing a HTML File

By a.b.babloo ·
Can anyone tell me how to print a html file using SSIS package.

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Getting SSIs to print ....

http://www.workz.com/content/view_content.html?section_id=521&content_id=5745

Using CGI and SSIs

CGI, the Common Gateway Interface, is a way for you to do things with you page that you can't do with plain HTML. For example, you can get feedback from the users or your page, generate pages "on-the-fly," and include the current date and time on your page.

Using CGI/Perl Scripts to handle forms

If you put forms on you page, you'll need a way to handle the data people enter into them. Scripts are what you need. Scripts are "simple" programs written in a language like Perl, one of the more common CGI script languages, that can handle the information sent to them. Writing a script from scratch is not all that easy, especially if you've never done any programming before. You'll spend hours trying to learn Perl (or any other language) just to make your forms work. You may be able to find a script on the Net that someone's written for people to download, but getting those to work on your web page can be very difficult, especially since the instructions that come with them are usually pretty bad. For all those people out there who've run into this problem, or don't want to, here's a free script, with easy directions on how to use it.

First, here's what the script will do:

* This script will take data sent to it from a form, sent in either the GET or POST method.
* It will write the input, along with the date and time it was submitted, and the browser the user was using (helps you find out which browser is the most commonly used) to a file on your server.

Here's what you need to do to use the script on your web page:

* Make sure your server will let you use CGI forms on your page. Some won't, some will, some will charge you a fee.
* Copy the text below into any text editor, and save it with a *.cgi file extension.
* Make sure the action= attribute of your form's FORM tag is the full address of the script. For example, ACTION="http://www.yourisp.com/yourname/cgi-bin/feedback.cgi".
* Read the lines that start with "#", and follow the directions given there.
* Make sure you upload the script in ASCII trasnfer mode with your FTP program.
* Make sure you change the file permissions of the file once you've uploaded it. You can use your FTP program if they include that feature, or use a telnet program and, while in the directory of the script file, type chmod 755 filename.cgi

#!/usr/local/bin/perl #This is the path of the perl interpreter. You may not need to change this, but check with your ISP


print "Content-Type: text/html\n\n";

$datetime = `date`;
$browser = $ENV{'HTTP_USER_AGENT'};

if ($ENV{'REQUEST_METHOD'} eq "GET") {
$input = $ENV{'QUERY_STRING'};
}
elsif ($ENV{'REQUEST_METHOD'} eq "POST") {
read (STDIN,$input,$ENV{'CONTENT_LENGTH'});
}


$input =~ s/\&/\n&ltbr>/g;
$input =~ s/\+/ /g;
$input =~ s/%(..)/pack("c",hex($1))/ge;

open(outputfile,">>../feedback/feedback.txt"); #this is where you put the full name of the file that you want the script to write to. In this case, it will write to feedback.txt in the feedback directory.
print (outputfile "$datetime \n&ltbr> $input \n&ltbr> Browser=$browser &ltp>&lthr>&ltp>");
close(outputfile);


print <<"End_html";

&lthtml>
&lthead>
&lttitle&gtThank You!</title>
</head>
&ltBODY BGCOLOR="#FFFFFF" LINK="#FF0000" VLINK="#C40000" ALINK="#FF0000" >

This is where you can put in whatever HTML tags you want. This HTML will show up when the user submits the form.


End_html


Using Server-Side Includes

Server-Side Includes (SSI's) are a way of putting data into your web page without having to manually enter it. You can add the current date, when a particular file was last updated/modified, and many other things, including a whole web page.

Here's how SSIs work: SSIs are commands on a web page enclosed in the HTML comment tag (<!-- a comment or SSI -->. When someone loads your web page, the server will recognize the command as it sends your page and plug in the data asked for, instead of the text of the SSI.

For example, the SSI <!-- #flastmod file="mypage.html" --> will tell the server to send the date and time of when mypage.html was last modified. flastmod is a UNIX command the server understands. In case your wondering, flastmod means File Last Modified.

Guidelines for using SSIs/Why yours won't work:

SSIs are really easy to use, just make sure you follow the following guidelines:

* Any web page file that has an SSI on it must have the extension *.shtml. Otherwise, the server doesn't know to check for an SSI in it, and any SSIs on the page will be ignored. NOTE: Your ISP can change this file extension to anything they want. *.shtml is the most common, but ask your ISP just to be sure.
* Make sure that you have spaces where they're needed, and that you don't have any where they're not needed. Don't put a space after the opening "<!--" of the SSI. There must be a space between the last letter/symbol and the first hyphen of the end of the coment tag. In the following SSI, the blue "X" marks the place where you can not put any spaces, and the red "X" marks the place where you need at least one space: <!-- X #flastmod file="mypage.html" X -->. So, the SSI should look like this: <!--#flastmod file="mypage.html" -->
* Make sure your Internet Server Provider allows SSI's. If you've checked everything else, ask your ISP if they do allow SSIs. Most do, but some don't because SSIs can slow down the server a little.

Here's a list of SSI's that you may want to use on your page:

* <!--#flastmod file="filename.html" --> Displays the date and time that filename.html was last modified. If the file (that you want to display the last modified date of) is in the same directory or a sub-directory of it, you can use file="filename.html" to specifiy the file, as shown. However, if the file is in a directory above the one that the file that has the SSI on it is, you need to use virtual="/a directory name if needed/filename.html".

* <!--#fsize file="filename.html" --> Displays the size of filenam.html. Very similar in usage to #flastmod. The file/virtual rule applies here, too.
* <!--#include file="filename.html" --> Includes a file on your web page. Can be any text file or another web page. file/virtual rule applies here, too.
* <!--#echo var="DATE_LOCAL" --> Display the current date and time. var="DATE_LOCAL" can be changed to any of the following:
o var="DATE_GMT" Displays the current date and time, in Greenwich Mean Time.
o var="DOCUMENT_NAME" Displays the file name of the file that this SSI is in.
o var="DOCUMENT_URI" Displays the URL of the file that this SSI is in. NOTE: URL's used to be called (and still are in programming) URI's (an "I" instead of an "L"). In the SSI command, be sure to use URI.
o var="LAST_MODIFIED" Displays the date and time that the file this SSI is on was last modified. Almost the same as #flastmod, but you cannot specifiy the file with this one.
..........................................
print (outputfile "$datetime \n&ltbr> $input \n&ltbr> Browser=$browser &ltp>&lthr>&ltp>");

http://library.thinkquest.org/10043/cgi-ssi.htm

Please post back if you have any more problems or questions.

Back to Peripheral Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums