catalyst2 community forums  

Go Back   catalyst2 community forums > Support > Scripting Support

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
Old 28-04-2008, 03:25 PM   #1 (permalink)
Registered User
 
Desmoduck's Avatar
 
Join Date: Sep 2003
Posts: 14
Response.Write Issue

Hello Gurus,

Here is my situation:

I have an asp page that displays the contents of a folder and creates links to the files [pdfs] for download.
This asp page is displayed in an Iframe. [I cannot change this right now]
I am looking for assistance in opening the link to the file[s] in a new window or a way to break out of the Iframe.

It is line 10 that is giving me trouble. Any help is greatly appreciated.


Here is the current code:


set FileSysObj=CreateObject("Scripting.FileSystemObjec t")
strFileAndPath = request.servervariables("SCRIPT_NAME")
strPathOnly = Mid(strFileAndPath,1 ,InStrRev(strFileAndPath, "/"))
strFullPath = server.mappath(strPathOnly)
set fldr=FileSysObj.GetFolder(strFullPath)
response.write("<H2></H2>")
set FolderList = fldr.SubFolders
For Each FolderIndex in FolderList
Response.Write ("<A HREF='" & FolderIndex.name & "'>" & FolderIndex.name & "</A><BR>")
Next
set FileList = fldr.Files
For Each FileIndex in FileList
'This bit excludes this page (and other asp files) from the list of links
if Lcase(right(FileIndex.Name, 4)) <> ".asp" then
Response.Write("<A HREF='" & FileIndex.name & "'>" & FileIndex.name & "</A></BR>")
end if
Next

I have tried adding TARGET="_top" and TARGET="_blank" to the Response.Write. That didn't seem to get it done. I must be missing something here. I can't seem to get it working....
__________________
_____________________
They have the Internet on computers, now?
Desmoduck is offline   Reply With Quote
Old 28-04-2008, 08:29 PM   #2 (permalink)
Bring me your problems :p
 
paulredpath's Avatar
 
Join Date: Jan 2003
Location: /dev/ahhhhhhhhh
Posts: 3,537
Hi,

What does one of the links look like when its processed? Could be missing something.
paulredpath is offline   Reply With Quote
Old 29-04-2008, 03:34 PM   #3 (permalink)
Registered User
 
Desmoduck's Avatar
 
Join Date: Sep 2003
Posts: 14
Hi Paul,

Thanks for the reply.

When the link is processed the associated file [pdf] opens whatever default pdf viewer is on the client in the iframe. That is my current problem. What I am trying to achieve is to have the asp create the the link [it is doing this already] but have it targeted to a new window.

I think I am definitely missing something when I add a target="_blank" to the response.write string. I am just having one of those moments where I just can't see it.


ORIGINAL:
Response.Write("<A HREF='" & FolderIndex.name & "'>" & FolderIndex.name & "</A><BR>")

MOD:
Response.Write("<A HREF='" & FolderIndex.name & " target='"_blank">" & FolderIndex.name & "</A><BR>")

Here is an example.
http://sharonct.org/pdfs/iframelinkerparent.asp
__________________
_____________________
They have the Internet on computers, now?
Desmoduck is offline   Reply With Quote
Old 30-04-2008, 10:07 PM   #4 (permalink)
Registered User
 
Desmoduck's Avatar
 
Join Date: Sep 2003
Posts: 14
OK.

Got it sorted.

Response.Write("<A HREF='" & FileIndex.name & "'>" & FileIndex.name & "</A></BR>")

should have been

Response.Write("<A target=""_blank""HREF=" & FileIndex.name & ">" & FileIndex.name & "</A></BR>""")

bourbon and sleep fixed it...

Thanks for looking Paul!
__________________
_____________________
They have the Internet on computers, now?
Desmoduck is offline   Reply With Quote
Old 01-05-2008, 06:13 PM   #5 (permalink)
Bring me your problems :p
 
paulredpath's Avatar
 
Join Date: Jan 2003
Location: /dev/ahhhhhhhhh
Posts: 3,537
Sorry, didnt see your reply! Glad you got it sorted however
paulredpath is offline   Reply With Quote
Reply

Thread Tools
Display Modes 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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 01:14 PM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.