• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 304
  • Last Modified:

Need help in variablizing my text

I am trying to make my MainCatPage Sub act as a container for the guts.

I took all the guts out of the MainCatPage Sub and tried to shove them into variable so that I could reference the variables from inside MainCatPage sub since I'm planning on using that Sub as the basis for many other pages where I wi ll just shove in different values for variables such as PageTitle and so on shown in the second link below.

I just need help formatting the syntax for both so that it works again after trying to shove stuff into variables.

Link 1 - container page

http://f2.pg.briefcase.yahoo.com/bc/dba332211/vwp2?.tok=bchedNVB.nh8RWkX&.dir=/EE&.dnm=Document2.txt&.src=bc

Link 2 - Where i moved out the core code and tried to shove them into variables for use wtih the Link 1, MainCatPage Sub routine

http://f2.pg.briefcase.yahoo.com/bc/dba332211/vwp2?.tok=bcpgdNVBr39NZLS1&.dir=/EE&.dnm=Document3.txt&.src=bc



0
dba123
Asked:
dba123
  • 9
  • 3
1 Solution
 
thefritterfatboyCommented:
I don't understand what you are trying to do exactly... but I know you will have trouble with this line:

SearchInclude = "<!--#include virtual=""/sss1/search/sss_search.asp"" -->"

Are you trying to use dynamic includes?
0
 
dba123Author Commented:
correct. that line is giving me trouble.

All I'm trying to do is replace certain portions of MainCatPag with variables that contain the code instead of hard coding the code in that sub.  Because that code will change depending on what page I show.  So I moved certain code into an include page and into variables that used to be in MainCatPag so that I can now reference certain code in MainCatPag through variables instead of hard coding it into MainCatPag
0
 
dba123Author Commented:
I didn't want to have to copy and create another MainCatPag for another page.  I want to just reuse the structure of MainCatPag but pass different recordsets, URLs, etc. into that sub depending on what pages I call.  So that is why I am variablizing some of the code that was hard coded into MainCatPag at the beginning....prior to me posting this.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
thefritterfatboyCommented:
Your first problem is that you cannot assign an include file to a variable.

They way to variablise text is as follows:

const txtTitle = "the title to my page"

...

<html><head><title><%=txtTitle%></title></head>

...

It is better to use constants as they are a little easier on your memory usage. Please note that you cannot change a constant. If you wanted to add a full stop to the constant, you couldn't do it. If your text may need altering, use a variable.

EG:

dim myVar
if myValue = 1 then
myVar = "there is only 1"
else
myVar = "there are " & myValue
end if
0
 
dba123Author Commented:
But my style is using Response.Write.  I need to know how to variablize it so that it will work inside my Response.Write statements.
0
 
dba123Author Commented:
I do not use constants, only variables
0
 
dba123Author Commented:
there has to be some way to do this in MainCatPage

 %><!--#include virtual=" & virtuallink & " --><%

where virtuallink = "/sss/search/sss_search.asp"
0
 
dba123Author Commented:
so is this the correct syntax in the MainCatPage to refer to the variables shown below:

      If Request.QueryString("action") <> "search" Then
            Response.Write (" & RecordSetCode_InitEntry & ")
      else
            Response.Write (" & RecordSetCode_SearchResults & ")
      End If
0
 
dba123Author Commented:
nevermind on the last question figured it out myself.  These are the things I'm trying to ensure are correct for example.

Just needed to do Response.Write RecordSetCode_InitEntry
0
 
dba123Author Commented:
Ok, so this doesn't work.  I"m trying to shove the stored proc and call to the stored proc into a variable

      If Request.QueryString("action") <> "search" Then
            strSQL = "sp_Get_Allsss_sss"
            Query.Open strSQL, objConnection, adOpenStatic, adLockReadOnly, adCmdText
      else
            Query.CursorLocation = 3
            Query.Open strSQL, objConnection, adOpenStatic, adLockReadOnly, adCmdText
      End If

to

      If Request.QueryString("action") <> "search" Then
            Response.Write RecordSetCode_InitEntry
      else
            Response.Write RecordSetCode_SearchResults
      End If

This is one example out of my page.  I need help with all my variables like this cause the syntax isn't right, it is erroring out on me

0
 
dba123Author Commented:
If you look at the second link, those variables  RecordSetCode_InitEntry and  RecordSetCode_SearchResults are defined fut the asp page doesn't like how I shoved the query and call into those variables for some reason.  It treats it as text instead of inline vb code in my MainCatPage sub
0
 
thefritterfatboyCommented:
It may be that your code is outside of a set of <% %> delimiter tags.

This is inline text
<%
'this is VBScript
%>
More inline text

You may find that a <% tag is missing.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 9
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now