Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    ASP




Includes


I have a table that I am using as a main skeleton for all my pages to use. The problems is that I want other pages to be inserted into a specific cell.

I have a skeleton.asp with 2 rows and 2 columns. I will create pages like company.asp which will have just text in them and they will use the include tag and include the skeleton.asp.

The problem is that I want the text only page to be inserted into the lower right cell on the table in the skeleton.asp. I have seen it done many times but I cannot remember what the tag was that you put in the cell to put the include contents there.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
ASP Includes?
As im used to using php im not to famillier with asp Is there such thing as a asp include? and how would i do it?

Includes
I have a folder structure that looks something like this.

root
->inc
->files
->system
->->area
->->group
->->->Layer3

etc.

I want to add a include file from the original folder level from the "inc" folder.
The file of where the include will be used is located within the folder named Layer3 folder.

How do I add in the include referencing the file.
Do i just use".."

For every folder level i want to go up to gain access to the file?
Do i just continue to add ".."?

ASP Includes
My web designer created my site with a header include or something to that effect. My question is this: How do I change each page title to what I would like for SEO purposes? When I put the desired title onto each page, my includes/header.asp file "overwrites" the desired title; thus, every static page has the same title. Creating separate include files would work but would take forever. I have even tried leaving the title tag blank in the includes.asp file and add the desired title to each static page, but the title tag doesn't end up in the <head>, just the <body> tag.

Xml Includes
I have a XML file that I've formatted using xsl. now I'd like to include that xml just like a normal file in an asp page.

I have the following code but it's really buggy and sometimes it works and sometimes it doesn't, really confusing!!! Code:

Includes
When writing ASP pages that have include pages, is best to make the include pages as txt, asp, inc??? which format would be the most efficient.

Includes
I've a big include asp file with a lot of function and subs, some of them with a long html code embebed, in this intranet and I'm not sure if I should break it in a several include files in order to improve the performance.

My question is:

leave it as it is because all that code runs into memory only once , say at log in, or
break it in several others, in order to access the code that really is to be accessed.

Includes
I have a page that uses includes.It has 1 include to bring in a header, 1 for the menu, and then there is a content area.

This content area I need to change.So, for example, the link would be index.asp page=aPage.asp and it would load my page that page witht the header and menu and for the content area include aPage.asp.

What is the script I can do this with. I tried simply using Response.Write and then just righting the <! #include --> tag with the right page in there, but it just writes that without parsing it and including that page.

Includes And CSS
I have an include, which is used as the header of my site, that has a bit of CSS coding in it. The CSS code along with an unordered list creates an expandable menu. The include works great when you view it at its URL, but the menu doesn't expand when a person has to access dynamic pages.

I have found out that the problem is that when the file is included the code is not inside the <head> tags, so thus the menu doesn't perform, or expand. Is there any snippet of code that could automatically put the CSS inside the <head> tags?

ASP Includes
I am trying to write a little script using includes ... but I am getting errors, I am passing a URL variable to use an include .Code:

<!--#INCLUDE VIRTUAL=Request.QueryString("path")-->

Am I missing something?

Includes Like ISS
I have made my asp pages but the left side navigation menu I want to be an include so if I ever change a link it's easy to update them all by changing the nav.asp file. How can I include the nav.asp file on the other asp sites like adminpanel.asp .

Includes
Can someone comment on the use of SSIs? Do these place a lot of strain on the server?
Also, are "virtual" includes or "file" include directives more efficient?

2 Asp Includes, And One Depends On The Other
I have a main file (asp), from which I include 2 different asp files. The second included asp file references an array element deefined and populated in the first include asp file. However, the array value is not being resolved in the second include.

This is not on a Windows server, but rather a UNIX server. However, the host provider claims ASP and SSI support.

How Do Includes Affect?
if there are alot of include file in ASP pages, what happens? the so much include files,the diffucult page load ?

<iframe> And Asp Includes?
saddled with using an <IFRAME> area on a classic asp page from the designer, so I'm trying to find out the following.

on that page I usually use the <IFRAME> to hold a simple HTML page, that the client will have access to from my CMS program so they can make edits, updates etc.

but, one page has a search functionality, written in classic ASP and using MS-Access dbase to find members of the association etc.

when I put the asp search page inside the <IFRAME> src , it wont show? ie --
<iframe src="findlawyer.asp" frameborder="No" width="756" height="427" id="iFrame" vspace="10">

-- should mean that the page findlawyer.asp should show up inside the holding ASP page (called simply find.asp)

why? when I look at the findlawyer.asp page online it shows up perfectly and works perfectly too....yet inside the <IFRAME> it refuses to show up???

Dynamic Includes From URL
Is there any way to dynamically generate an include file based on a variable passed to the asp page via a url ?- so for example:

Person x clicks on a url - that ur directs them to template.asp (template.asp has no code in it other than page title etc and <!--#include file="<%variable%>" --> )

Once in template.asp the page loads the include file that is relevant to the companies website that the link was clicked from.

In that include file will be the correct form and stylesheet setting for that company.

What we are trying to do is achieve a global template file which multiple customers can direct peo[ple through and all the data is therefore stored in one central repository.

The file displayed when they reach template.asp will depend on the url they clicked. Basically how can i get the url to pass the variable which the include file will then load??

Nesting Includes In Asp
would there be a limit to the amount of nesting one can do with includes in asp? what would be a good rule of thumb?

Conditional Includes
Will this work in asp 3.0:

If True Then
<!-- #include file="test1.asp" -->
Else
<!-- #include file="test2.asp" -->
End If

Runtime Includes
I need to include an .asp file into another .asp at runtime, but I need to do it based either on data returned from a dB or from the querystring. Since Server Side Includes happen before any script code is processed I can't accomplish this task using SSIs. At least not that I'm aware of.

The intent is to get a custom style sheet and/or theme design template based on who the user is or which site their visiting e.g. site1.domain.com has a default template of clouds and site2.domain.com has a default template of water, but both may be set by the user to their template choice.

Dynamic Includes
how can i include aspp files dynamically using

<!-- #include file="somefile.asp"-->

Includes And Stylesheet
I have an index page (home.asp) that calls several includes to create the whole page (ie side.asp, top.asp, body.asp). If I externally refer to stylesheets in my homepage, they don't seem to transition into my includes. I can put a <head> on each of my includes and put the internal CSS there. This works, but doesn't seem right, and looks funny in source code seeing multiple <head> tags.

recommend a good tutorial for intermediate CSS? I read Yahoo's source code and I don't understand a lot of what they're doing there... I feel like I'm just a few steps behind understanding that.

Dynamic Includes
I am currently working on a template that will be replicated over 200 sites or so. The first of these have been interesting. I'm trying to work out the best ways to replicate these sites and need help with a left sidebar containing links to the first 40 sites. Go to carpetbid.com or spabid.com. I tried doing an include over multiple sites but have read a lot about it and see that this doesn't work.What should I do?

Includes With Variables
I'm trying to create some includes with vars from the query string, but it's not going well. Lets say i get some vars from the url ['lang' and 'page'], sanitise them, and then try to use them in the include. I've tried all sorts . Code:

<!--#include file="<%=lang%>/<%=page%>.asp"-->

Code:

Response.Write("<!-- #include file=""+lang+"/"+page+"" -->")

but nowt seems to work.

Includes And Tables
Is there a way to include a large list (.html page) in a table and force a scrollbar instead of resizing the cell to fit the entire list? I'm wondering because I have a navbar on the left that links to different parts of the list (months), and I would like it to stay on the screen, even when scrolling down near the bottom.

Simple Question About Includes
I have a menu I want to include on every page but may update at a later stage so it's easier to use an include. The menu is just a basic html table, no vbscript contained within it. The site is a mixture of static page and ASPs, should I use #include file ="menu.htm" or #include file="menu.asp"?

Also if I have a .htm page, can it have an #include file="menu.htm" or must I give that page a .asp extension?

Includes, Images & Sub Directories
I'm creating a site which will have the home page at the root level, but all of the sub pages in sub directories:

root/
-homepage.asp
-subdirectory/
subpage.asp
-images/
logo.gif
-includes/
header.asp
Each page of the site will have the include <!--#include virtual="/includes/header.asp" -->

header.asp is a table with our company logo, logo.gif. The problem I'm having is that subpage.asp does not display logo.gif because the path in the include is only correct at the root level.

I don't want to create multiple includes. Is there another way to make this work that I'm missing? Thanks!

ASP Vbscript Class Includes
I'm running into a problem with VBSCRIPT classes in ASP. I use a seperate file for each class I use. Some of these class files are included in multiple ASP scripts, but are also included in other include files. So if you can't see the problem already, it is that occasionally the class file will be included twice in the same script, relsulting in the following error:

Microsoft VBScript compilation error '800a0411'

Name redefined

/includes/classes/closableobjectlist.asp, line 2

Class ClosableObjectList
------^

Does anyone know a clean solution for this problem?

Javascript Includes Not Recognised
I have web pages that are made up of a number of javascript include files as
well as 'in page' script. They all work fine running locally until I hosted
them on our IIS server. Then the pages refuse to see nested javascript
calls. e.g.

Main page contains JS code to call a function to one of the include files (-
no probs), which in turn wants to call a function in one of the other JS
include files but falls over with 'object expected' error in the line of
that call - I assume because it can't fine the function.

I think it may be something to do with processing order but as these files
are almost identical to another site that I created (certainly the JS
include files are and that worked 100%),

Includes And HTML Comments
The use of includes in ASP is good where code is re-used in multiple forms,etc. (doh, ... that's what they _are_ for ! ). If I have something like: Code:

Server-Side Includes
The book I am referring to learn ASP states the following about server- side includes:

==============================================
The code in a server-side include file is inserted into the pages that use it BEFORE the page's ASP code is evaluated. This means that you can put ASP code inside the include file, and it will be executed like it was part of the page that includes it. On the other hand, it means that you cannot use ASP to determine which page to include.
==============================================

But as opposed to the last line in the above para, the following code makes use of ASP to determine which page to include: Code:

COMs, DLLs, Includes
I have a web page, that is part of a content management system i am writing, it includes a large number of scripts and displays one of these scripts according to the contents of the querystring (the design is done this way so scripts can be used across different websites that i manage on a dedicated server)

the problem is that this design is not very scalable and no matter how well i write my code to make it as concise as possible the main page will start getting slower and slower. The answer I initialy thought was some sort of dynamic include but i realise that that is impossible. So what are my options? I have heard of coms and dlls but know very little about them is this the way to go?

Server Side Includes
I am troubleshooting a web site (not written by me) and may of the pages use server side includes. This one page includes a page that return includes the page the included it.

Page 1 (_connection.asp):
<!--#include file="MGroups/MRdisplayfun.asp"-->

Page 2 (MRdisplayfun.asp):
<!--include file="../_connection.asp"-->

The site is quite slow and when I first found this I thought that this was the primary cause of it. Then I thought this page shouldn't work at all because it would create an infinite loop and should just recursively call the pages and eventually consumme all server resources and database connections.

However it doesn't appear to act that way and the page does display and there is no endless calls to the SQL statements in the two pages. Is there something that prevents recursive calling when using SSIs?

Secure Dynamic Includes
Is there a way to make this script more secure?

I usually do my coding in php where i can strip slashes and tags to prevent evil code from being included.

can something similar be done with asp?

<%
dim pid
pid = Request.QueryString("pid")
if pid = "" then
fil = "content/page1.asp"
else
fil = "content/" & pid & ".asp"
end if
Server.Execute(fil)
%>

Dynamicaly Building Includes
i want to generate the an include file such as

<!--#include file="nav/nav_1.asp"-->

but by calling the number from strNav

<!--#include file="nav/nav_<%=strNav%>.asp"-->

i have several combinations of quotes etc but cant get it to work . is there a way?

Alternatives - Can't Use Dynamic Includes
I'm well aware that you can't use dynamic includes (eg: <!--# include file="path/<%=strPath %>"-->) due to process order in ASP, but I really need to find a work-around.

I can't use TextStream because the files will need to execute.

Server.Execute causes a "Type Mismatch" in the script it executes that functions fine under normal circumstances so I don't know why - though admittedly I'd rather not use this method (it's well documented to be not a very good idea anyway!) so I haven't tried too hard to fix that issue...

All I want to do is say "If a file exists, execute it - if not, do nothing!" Here's my (broken) code - this represents what I would like to achieve though obviously this example will never work because of the required dynamic include. Anyone got any genious ideas to achieve the same results as this script would if it worked? Code:

Preventing Multiple Includes
Is there a way in ASP to prevent including the same file more than once?

Example:

dbutil.asp needs constants.asp, so I include constants.asp inside dbutil.asp.

transact.asp also needs constants.asp, so I include constants.asp inside transact.asp.

transact.asp doesn't need stuff in dbutil.asp, and dbutil.asp doesn't need stuff in transact.asp.

Then later I might have a main.asp that needs both dbutil.asp and transact.asp. So I include them both. However, the constants.asp will be found to be included twice!

What can I do to creatively prevent multiple inclusion of the same file in ASP? I know how to do it in C and C++, but I can't apply that to ASP, it seems.

Creating An Xml Doc That Includes Encoding.
I'm trying to make an xml doc that gets passed to sql server, but I keep getting an xml parsing error. When i printed out the xml string, the encoding is not on there despite my putting it there... Code:

Server Side Includes In Xsl/asp (IIS)
I have an xml document with a corresponding xsl file. I have the option of serving the xml directly for client side transformation or using a basic .asp file to transform the xml into xhtml.

All things being equal, I'd prefer to have the server do the transformation to avoid browser problems. Both options are basically working and the data in my xml files are being displayed properly through each method. Code:

Performance Of IFRAMES Versus Includes
The default ASP generates the HTML response including several IFRAMES. It takes a long time to load this page. I believe a lot of it is round trips to load the IFRAMES. Couldn't include files be used to increase this performance, so everything is done in the initial call instead of multiple round trips?

Changing Page Title With Includes
I have one comment before I begin. An ASP Forum site using PHP, doh.

All of my pages begin like this:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html><head><!--#include file="header.htm"-->

<link href="css.css" rel="stylesheet" type="text/css">
<title>Some page</title></head>

I saw a friend change all of the titles using a code that looked something like :
<%pagetitle = "Title" %> In the header document. My question is where does this go in my header document and how do I reference it in all of my other pages?

Option Explicit Workaround For Includes
I have a website with many pages where some pages use option explicit in the pages and some do not. I am trying to add a footer include file to be added to the end of every page... and the include footer is going to have some ASP code that checks a table in our database based on whether or not it finds a value in a page variable in the page that called the include footer file.

in some cases... there will be no varible on the calling page... in those cases the footer has code that will goto the database and update somthing there. In other cases the varibles will be hard coded defined with values.

My problem is that the include file (the footer file) needs to check for those varibles... and I have to make sure I DIM the varible before checking it... but if it was previsously dimed in the main page i will get a redim error... and on the pages where there is an option explicit call... I can dim the varible name in the include. Code:

File Includes- Design Problems
I have an ASP site with about 50 ASP files, all of which are currently including a common "includes.asp" file near the top of the file, responsible for generating the <HEAD/> section of the HTML.

I need to make a change for 3 of those ASP files such that some dynamic HTML is generated in the <HEAD/> section. I want those dynamic HTML to appear only for 3 specific ASP files. Is there a more elegant way other than to:

1) Dim strOptionalDymanmicHtml1 in includes.asp
2) Initialise strOptionalDymanmicHtml1 to "" in includes.asp
3) In the 3 ASP files which require additional optional dynamic HTML,
initiliase strOptionalDymanmicHtml1 *before* including includes.asp

There is an additional even more tricky problem, I have most file taking this structure Code:

How To Do Internationalization In Classic ASP (w/o Dynamic Includes)?
I'm using classical ASP on IIS 6.0 (Windows 2003 Server). What I want to do is to serve the same pages in two different languages without using two different folders and doubling my same ASP code and changing the string values.

What I need is DYNAMIC INCLUDE functionality similar to PHP, however I know that I don't have it in ASP. Moreover Server.Execute is useless because it doesn't have a functionality like an include file, calling some file (that includes language string constants) conditionally is not useful because when the file is executed its scope is over and I cannot reach the constants or variables defined in that file.

What do you advise in such a situation? I need two groups of constants, one for English, one for Turkish, like: ....

Cost Of Includes Vs. Server.Execute
Im scripting for a site that has a lot of includes. Im trying to optimize and make things faster - since the site has unique 20000 visitors a day.

<!--#include file="somefile.inc"-->

more expensive to use than:

Server.Execute ("somefile.inc")

In terms of memory and cpu? Any comments with pros and cons would be a great help. Im working on ASP3 and an IIS4 *damnit* .

Random Server Side Includes
What I would like to do is randomize which file gets used with as a server
side include. Here is what I have so far: Code:

SSI - Server Side Includes - Navigation?
I am using SSI navigation on my new ASP web site. On the original HTML version, if you clicked a link on the main navigation and entered a section, for example, SKILLS, the skills link on the navigation would be highlighted in a different colour, so the user would know which setion the were in.

To achieve this, in every single HTML page, I changed the CSS tag of the selected section. For example, Code:

Nested Includes Not Working As Intended
I'm working on a new site that has a nearly empty index file (variable
location) that includes a template file (set location) which in turn
includes two data files (variable location dependent on index file's
location). This concept worked in PHP and I'm just playing around with it
in ASP to see if it can make my site management easier because I can't move
to Apache for a while.

It seems that the template file can only include relative to itself and also
with specific paths, but it can't include relative to the original index
file.

Server Side Includes & Processing Time
I've been using SSIs for a while now. I'm now using them in a menu system. I'm trying to use multiple SSIs, that is SSIs within SSIs, but I'm just wondering if this will slow the pages down, and put too much strain on the server. I'll try to illustrate what I'm doing.

This is a dropdown menu system. Rolling over Link1 will reveal Link1-a, Link1-b and Link1-c, and likewise with Link2 and Link3: Code:

Server-side Includes (IIS 5, Classic VBScript)
I am building up a library of Class'es that represent various columns of
table layouts. One often used column is "name" and each occurrence is
treated identically. (What a concept, eh?)

Part of that library of Class'es includes representations of various tables.
(Just let me know if you see a trend going on here.) These Class'es use the
column Class'es.

What I would like to do, but I have yet to find a way around duplicated
names, is to place all the necessary supporting column Class #include's in
the table's Class so that I need only place the table's Class in the module
utilizing them.

I understand entirely why the "duplicate name" error occurs.

What I am looking for is a way around the conundrum that does not require
duplication of code. Any ideas?

Host Doesn't Support Server-side Includes
I've just been caught out by a host that doesn't support #includes in my
ASPs. What's the best strategy for replacing these calls to files that
include everything from subs and functions, global constants, other
#includes, script directives, etc.??


Copyright © 2005-08 www.BigResource.com, All rights reserved