Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-18-2005, 06:43 PM   PM User | #1
acc
New to the CF scene

 
Join Date: Jan 2005
Location: TO Canada
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
acc is an unknown quantity at this point
loading external file into a div

i know this is possible, because i was able to do this already with javascript using div and innerHTML, but i encountered problems. i probably will end up using js still at an extent, but the goal is dynamic content and minimizing load time.

what i need to do is:
- have one page with the menus and background

- have a number of div layers that depending on what link is clicked on, it will call on an asp page (say news/events) that will be displayed on a div layer

- and on this external file, will still contain div layers whose content will change as well based on the links in that external file loaded


why am i doing this?
- especially for my company's news and press releases and other archives they have, i want one page with all the links that will show the content without refreshing every page.

but...i don't want to use a database nor iframes and anyone know how i can change the "title" on top of the browser depending on the asp loaded?

any help as to where i can start this off would be great!
acc is offline   Reply With Quote
Old 01-18-2005, 08:59 PM   PM User | #2
BrockLesnar
New Coder

 
Join Date: Jan 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
BrockLesnar is an unknown quantity at this point
If you have Response.Buffer set to True, you can use this method.

<Title><%=Title%></Title>


Then somewhere in your page put this
<%
Title = "This is this pages title"
%>
BrockLesnar is offline   Reply With Quote
Old 01-19-2005, 11:32 AM   PM User | #3
ghell
Senior Coder

 
Join Date: Apr 2003
Location: England
Posts: 1,192
Thanks: 5
Thanked 13 Times in 13 Posts
ghell is on a distinguished road
so you want to load all the pages into DIVs so that they all load at once and change instantly?

to load a page into a DIV with asp you can either use FSO (see w3schools, search google for "asp fso reference" or use the link in my signature if it works) or use a server side include
<div id="home"><!--#include file="pages/home.asp" --></div>
or use
<div id="home"><%Server.Execute("pages/home.asp")%></div>
(all methods need to be done for every page)

the link's onclick attribute can be used to set the visibility or position or block/inline style of the div so that it shows, and also set the title (i cant remember how you set the title but its probably something like window.title = 'home'; (in which case you dont need "window." .. its probably the same as status but with title) or document.title = 'home';
__________________
My tech/code blog
ghell is offline   Reply With Quote
Old 01-19-2005, 01:07 PM   PM User | #4
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
I think you need to use an iframe.
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Old 01-19-2005, 02:29 PM   PM User | #5
acc
New to the CF scene

 
Join Date: Jan 2005
Location: TO Canada
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
acc is an unknown quantity at this point
giving error

wow, responses in this forum is much faster than other ones i'm in.

actually, what i want to do is to load content on a div layer when called upon by a link (example: if a date in press release is clicked, the full press release will show into a seperate div layer). and as links are clicked, different content will be loaded to that same div layer.

found a script that does this, but when i test it on our website's server it gives me "the page cannot be displayed" and the provider said that asp is supported.

i'm a totally newbie at asp, problem is i'm trying to learn and do the work needed for our site at the same time, so please bare with me

here's the scripts:

declaring the cases

PHP Code:
<%
Select Case p
Case 1: %>
< !--
#include file="page3.html"-->

< % Case 2: %>
< !--
#include file="page4.html"-->

< % Case 3: %>
< !--
#include file="resume.htm"-->

< % Case 4: %>
< !--
#include file="photos.htm"-->

< % Case 5: %>
< !--
#include file="contact.htm"-->

< % End Select %> 

for index.asp

PHP Code:
<%
dim p
p=Request.QueryString("p")
If p= "" Then
p = 1
End If 
%> 

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="CP_ACP"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ASP: loading external content</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>

<body>
<center>
<table width=500 border=1>
<tr><td><a href="index.asp?p=2">trial</a></td></tr>
<tr><td><!-- #include file="whichpage.asp" --></td></tr>
</table>
</center>
</body>
</html>

to see what i'm talking about go to this link
http://www.amplis.com/amplis_new/trials/index.asp

i tried the html files in the same folder (page3.html) and it shows

Last edited by acc; 01-19-2005 at 05:23 PM.. Reason: found new info
acc is offline   Reply With Quote
Old 01-19-2005, 08:16 PM   PM User | #6
miranda
Senior Coder

 
Join Date: Dec 2002
Location: Arlington, Texas USA
Posts: 1,062
Thanks: 4
Thanked 8 Times in 8 Posts
miranda is an unknown quantity at this point
your link page has an error

you need to change the page accordingly

Code:
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="CP_ACP"%> 

<% 
dim p 
p=Request.QueryString("p") 
If p= "" Then 
p = 1 
End If  
%>  
<?xml version="1.0" encoding="iso-8859-1"?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<title>ASP: loading external content</title> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
</head> 

<body> 
<center> 
<table width=500 border=1> 
<tr><td><a href="index.asp?p=2">trial</a></td></tr> 
<tr><td><!-- #include file="whichpage.asp" --></td></tr> 
</table> 
</center> 
</body> 
</html>
miranda is offline   Reply With Quote
Old 01-20-2005, 01:57 AM   PM User | #7
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
Quote:
Originally Posted by acc
i want one page with all the links that will show the content without refreshing every page.

but...i don't want to use a database nor iframes ...
If you really want not to refresh the whole page, then you need to use iframe. The current solution you're using will refresh the page when the link is clicked. But if you want to stick with it, one workaround for dynamic include is to use FileSystemObject.

http://www.learnasp.com/learn/includedynamic.asp
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app

Last edited by glenngv; 01-20-2005 at 02:00 AM..
glenngv is offline   Reply With Quote
Old 02-28-2005, 08:01 PM   PM User | #8
acc
New to the CF scene

 
Join Date: Jan 2005
Location: TO Canada
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
acc is an unknown quantity at this point
Quote:
Originally Posted by miranda
you need to change the page accordingly
i'm sorry but i don't exactly know what you mean by this.
acc is offline   Reply With Quote
Old 03-02-2005, 06:43 AM   PM User | #9
miranda
Senior Coder

 
Join Date: Dec 2002
Location: Arlington, Texas USA
Posts: 1,062
Thanks: 4
Thanked 8 Times in 8 Posts
miranda is an unknown quantity at this point
The @ declaration ALWAYS goes on the very first line. I must not have paid attention that it says you are using javascript as the server side page language. Because of this, the if statement would look like this.

<%
var p = Request.QueryString("p");
if(p == ""){
p = 1;
}
%>

Javascript or jscript does not use the dim keyword to declare (dimension) a variable. Instead it uses var.
Statements in javascript end with semicolon;
If statements in javascript/jscript do not use end if.


Also because this page is ASP with javascript as the default server side language, any (ASP not PHP) page called via an include file must also be in server side javascript, and any VBScripting would need to use script block demonstrated as such <script languge="VBScript" runat="server"> </script>. Switching in and out of the server side languages is not a good practice and the ability to use both on one page has been eliminated from asp.net.

As glengv pointed out you need to use an iframe to have an asp page display info on it from an included php page. Likewise for a php page to display asp info. Either the asp processor or the php processor will process the page not both.

BY The way, if from IE you click Tools > Internet Options > Advanced > and then unclick the box next to Show friendly HTTP error messages, you will see that you are given the following error

Microsoft JScript compilation error '800a03ec'

Expected ';'

/amplis_new/trials/index.asp, line 4

dim p
----^

Last edited by miranda; 03-02-2005 at 06:48 AM.. Reason: typos corrected
miranda is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:56 PM.


Advertisement
Log in to turn off these ads.