I am starting to look at includes to use in my pages on our intranet and i was wondering whether it is possible to use different types of code in a single page such as
Nope
It's simply set out as any other page just in seperate sections.
so if you have a common functions include that could go at the top. an include with javascript in could be there, the style sheet could be an include as well though these are better as external files and linked in.
so wherever a section would be normally be in the page you simply replace that code with the <!--#include file|virtual ="filename"--> directive. With filename pointing to the appropriate file of course
Chris,
thanks for that, it has helped me understand better the use of includes. I will start trying it tomorrow although i am sure I will be re-visiting this post for more info if need be
Sorry Chris, just one more question, If I say add all of the functions I use for a particular subject on our intranet(which may contains up to 20 pages) into one include page even though some of the pages may only use one of the functions, will this slow down the refreshing of pages ?
not by any noticeable margin. only functions that are actually operating take CPU time up. It will take up some memory to store the fuction names though.
OK,thanks that should not be a problem the server that our Intranet is on has 1GB memory. I am thinking along the lines of having one include for all my vbscript functions and one for all my javascript functions, and then doing as you suggested with the CSS by linking them.
that should work ok. I go even further than that and split the functions into related groups.
so file, text, SQL, maths, navigation function all have their own include file. constants and variables have seperate includes as well.
This means I can easily find any particular function rather than wading though one file with hundreds of functions in it.
Then I have a include file that is a list of include so if I add a new group or split them up further, there is only one file to edit. option explicit is the first line of this file so it doesn't get missed. Like so.
I even go as far as having an include that includes the CSS file so I could rename or move (or split into several) the style sheet and I still only edit one file rather than hundreds.
This approach comes from working on an intranet where if it wasn't done an hour ago it was too late. and I could say "That will take a couple of hours" knowing it would take 10 mins and earn myself some peace and quiet.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.