Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Need Help on Dynamic Include
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

shaneb
Junior Member

USA
319 Posts

Posted - 05 March 2001 :  02:14:41  Show Profile  Send shaneb a Yahoo! Message
Can anybody show me what the proper way would be to write this. I want to do a dynamic include of sorts. My problem is I have a DHTML scroller populated by the database using ASP. It looks good in I.E. but terrible in Netscape. So for a work around I want to include the DHTML Scroller if it is I.E 4.0 or above and if the person is using anything other than I.E 4.0 and above. I want to use a different include that doesn't have the scroller.

The code I think would be something like this. I'm not an ASP guru so don't laugh please.


<%Select Case pickFile Case 1: %>
<!--#include virtual="/inc_jobs_scroller.asp" -->
<% Case 2: %>
<!--#include virtual="/inc_jobs.asp" -->
<% End Select %>

<% If Browser = I.E. 4.0 or above Then Case 1
Else
Case 2
End If %>



Please help

'Surround your mind and you shall see a great future ahead'

Shane B.

Doug G
Support Moderator

USA
6493 Posts

Posted - 05 March 2001 :  03:04:40  Show Profile
Sorry, it won't work the way you want. The code from both include files will always be included in the completed asp page.

Also you can't use If ... Then Case 1, that isn't a correct syntax.

You could add the different code as functions on your page, or wrap the code inside a VBS class, but you'll still have all the code for both browsers in your page.

I haven't messed with it much, but the IIS5 Server.Transfer or Server.Execute may provide a solution.

I'd just write the code in two functions myself and call them like:

Select Case pickFile
Case 1
result=IEScroller()
Case 2
result=NSScroller()
End Select
Response.write result
...
...



======
Doug G
======
Go to Top of Page

shaneb
Junior Member

USA
319 Posts

Posted - 05 March 2001 :  09:51:55  Show Profile  Send shaneb a Yahoo! Message
Thanks,

I told you I don't know that much yet about ASP. I have bought three books on it but haven't had time to crack them open. Is there anybody that can show me all the code I would need to do this. I have looked at all the ASP sites (at least the ones I know about) and have found no examples on how to do this. I know there is no such thing as a true dynamic include, but I know there has to be a work around. I'd really appreciate anybody's help on this.

Thanks

'Surround your mind and you shall see a great future ahead'

Shane B.

Go to Top of Page

shaneb
Junior Member

USA
319 Posts

Posted - 06 March 2001 :  02:00:32  Show Profile  Send shaneb a Yahoo! Message
Never Mind This is the solution if anybody is interested.

<%

Set oBrowser = Server.CreateObject("MSWC.BrowserType")

sBType = oBrowser.browser
nVersion = oBrowser.Version

'oBrowser.close
set oBrowser = nothing

If sBType = "IE" then %>

<!--#include virtual="/inc_jobs_scroller.asp" -->

<% else %>

<!--#include virtual="/inc_jobs.asp" -->

<% end if %>


'Surround your mind and you shall see a great future ahead'

Shane B.

Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 06 March 2001 :  10:45:35  Show Profile
Keep in mind, though, that the code from both include files are present in your page. You are conditionally executing the code, not conditionally including the code. This will cause errors if the include files Dim variables of the same name, or have functions, subs, or classes of the same name in each include file.




======
Doug G
======
Go to Top of Page

shaneb
Junior Member

USA
319 Posts

Posted - 06 March 2001 :  14:07:11  Show Profile  Send shaneb a Yahoo! Message
quote:

Keep in mind, though, that the code from both include files are present in your page. You are conditionally executing the code, not conditionally including the code. This will cause errors if the include files Dim variables of the same name, or have functions, subs, or classes of the same name in each include file.




======
Doug G
======



I'll keep that in mind. I have this code up and working on my site. If you have both I.E and Netscape you can see that it works without errors. Look on my homepage at http://www.brass-in.com and you will notice I have a scroller if you view the homepage in I.E. If you use Netscape you get a static listing (No Scroller).

'Surround your mind and you shall see a great future ahead'

Shane B.

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.38 seconds. Powered By: Snitz Forums 2000 Version 3.4.07