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

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

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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?
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
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.
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

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"




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.


dim myVar
if myValue = 1 then
myVar = "there is only 1"
myVar = "there are " & myValue
end if

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
dba123Author Commented:
I do not use constants, only variables
dba123Author Commented:
there has to be some way to do this in MainCatPage

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

where virtuallink = "/sss/search/sss_search.asp"
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 & ")
            Response.Write (" & RecordSetCode_SearchResults & ")
      End If
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
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
            Query.CursorLocation = 3
            Query.Open strSQL, objConnection, adOpenStatic, adLockReadOnly, adCmdText
      End If


      If Request.QueryString("action") <> "search" Then
            Response.Write RecordSetCode_InitEntry
            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

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
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.