Include file and Functions

Results 1 to 2 of 2

Thread: Include file and Functions

  1. #1
    Xena Guest

    Default Include file and Functions

    I want to do the following but I am not sure how.<BR>I want to create an include file that declares a variable called "Goalpic". Then I want a function that says, If CSI (a field in my database) &#062;= 68.8 Then goal pic = image A, if not goalpic = image B. If Sales (another database field) are &#062;= 100 Then goalpic = image A, if goalpic = image B.<BR>In my asp page, I have &#060;img src = "&#060;% =CalcCSI %&#062;"&#062; and &#060;img src = "&#060;% = CalcSales %&#062; where I want the values of the variables to be displayed, but I need help setting up this include file. Any help would be greatly appreciated. I feel I am going to have a nervous breakdown!

  2. #2
    Join Date
    Dec 1969

    Default RE: Include file and Functions

    Include file would be contain the regular code like:<BR>&#060;%<BR>Dim goalpic<BR>If CSI &#062;= 68.8 then<BR> goalpic = imageA<BR><BR>etc...<BR>%&#062;<BR><BR>Then, you include the file with this line in your asp file:<BR><BR>&#060;!--#include file="nameofinclude.asp"--&#062;<BR><BR>If the include file is in a different directory, I&#039d suggest using a virtual path:<BR><BR>&#060;!--#include virtual="/path/from/root/to/file/nameofinclude.asp"--&#062;<BR><BR>However, you have to make sure that any variables references within the include are already declared, filled with values, etc, before you include the file. Better yet, youcould make a function in the include and pass it everything it needs, as in:<BR><BR>function GetPicture("csi", 65.7)<BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts