Forums
This topic is locked
slicing your page in different include's
Posted 10 Jun 2003 23:53:23
1
has voted
10 Jun 2003 23:53:23 Berry van Elk posted:
I have used the dreamweaver templates for quite a while now and i'm not very happy with it. If you want to make a correction it doens't change the recordset's, and somethimes (on my computer) the program template updater didn't worked out correctly what caused a lot of damage to a few pages.For this reason I am thinking to split up my templates in include files, things like polls, headlines etc etc that are on most common pages. Now I know that a include file is loaded before the asp script in the page itself does, what brings me to an big error.
Can someone explain me how I can do this on another way? I just want to make a change in 1 file that corrects the whole site without using the Template manager in dreamweaverMX, I think the updater is working fine for simple pages, but in a page with more than 5 recordsets it's generating errors on my system.
Replies
Replied 13 Jun 2003 02:09:17
13 Jun 2003 02:09:17 Phil Shevlin replied:
Includes should work fine for you. The only problem you will run into is if you want to dynamically load includes. For example:
if (some event) then
include such and such file
end if
This is a dynamic include and won't work because includes occur before the code is executed.
Search "dynamic includes" There are tutorials on asp101.com and aspfaqs.com
if (some event) then
include such and such file
end if
This is a dynamic include and won't work because includes occur before the code is executed.
Search "dynamic includes" There are tutorials on asp101.com and aspfaqs.com
Replied 13 Jun 2003 09:16:46
13 Jun 2003 09:16:46 Berry van Elk replied:
Yes ok, this is to load them dynamically into the page, that's step 2 for me.
What I need to need is how the content of that recordset will be shown into the .inc file.
If I want to create a simple headlines.inc file with a simple recorset and 10 latest headlines in it. Do I need to put the recordset query in the asp file or in the .inc, and what about the connection file ?
I try'd a lot of thing but it wouldn't work
What I need to need is how the content of that recordset will be shown into the .inc file.
If I want to create a simple headlines.inc file with a simple recorset and 10 latest headlines in it. Do I need to put the recordset query in the asp file or in the .inc, and what about the connection file ?
I try'd a lot of thing but it wouldn't work
Replied 13 Jun 2003 13:10:37
13 Jun 2003 13:10:37 Phil Shevlin replied:
I would suggest you open, display and close the recordset all inside the include.
Just build small pages that contain each component (i.e,, header.asp, footer.asp, news.asp, links.asp, etc.)
Test each separately. Make sure they work fine when displayed on their own. Then remove all the html, head, body tags. Make sure you revove the [@LANGUAGE="VBSCRIPT" CODEPAGE="1252] tag from each include or you will get an error.
Then just use a table (or layers) to position each include on you actual pages.
Three other suggestions:
1) name your includes inc_header.asp, etc. The inc_ heads you easily identify them. And using the .asp extension prevents people from viewing your code. If they were to try to browse header.inc it would display your code, not run the code.
2) store the includes in a include folder for easy organization
3) Use root relative links (img src="/images/spacer.gif" for all your includes. This way if you ever decide to use the includes inside different levels of your directory the links will still be valid.
I do this all the time. Hope this helps.
Edited by - wdglide on 13 Jun 2003 13:28:37
Just build small pages that contain each component (i.e,, header.asp, footer.asp, news.asp, links.asp, etc.)
Test each separately. Make sure they work fine when displayed on their own. Then remove all the html, head, body tags. Make sure you revove the [@LANGUAGE="VBSCRIPT" CODEPAGE="1252] tag from each include or you will get an error.
Then just use a table (or layers) to position each include on you actual pages.
Three other suggestions:
1) name your includes inc_header.asp, etc. The inc_ heads you easily identify them. And using the .asp extension prevents people from viewing your code. If they were to try to browse header.inc it would display your code, not run the code.
2) store the includes in a include folder for easy organization
3) Use root relative links (img src="/images/spacer.gif" for all your includes. This way if you ever decide to use the includes inside different levels of your directory the links will still be valid.
I do this all the time. Hope this helps.
Edited by - wdglide on 13 Jun 2003 13:28:37
Replied 13 Jun 2003 13:36:29
13 Jun 2003 13:36:29 Berry van Elk replied:
Thank you very much, no i understand what I did wrong.
Many thanks
Many thanks