473,406 Members | 2,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Reading blocks..

80
Hey all!

Is it possible to read blocks of a .asp file in that way that my page have the following three fields:

hey.asp:
ptitel="hej"
pbody="yeah"
pbottom="you read this.."

So i wanna read the line with ptitel in default.asp much like Server.Execute("hey.asp?read=ptitel")

I know Server.Execute wont work.. Is there another way?

Thanks!
Frederik
Feb 21 '09 #1

✓ answered by jenkinsloveschicken

Pheddy,

I know I'm late here, but if you are still looking for resolution, perhaps this will help. You can use GET or POST variables in the page to create condition filters like so-

hey.asp?view=1

Expand|Select|Wrap|Line Numbers
  1. <%
  2. Dim int_userView As Integer
  3.  
  4. '''Set int_userView = GET variable value
  5. int_userView = Request.QueryString("view")
  6.  
  7. Switch Case int_userView
  8.  
  9.    Case 1
  10.        ptitel="hej"
  11.    Case 2
  12.        body="yeah"
  13.    Case 3 
  14.        pbottom="you read this.."
  15.  
  16. End Select
  17.  
  18. %>
  19.  
  20.  
That's one overly simplistic example. If you are using asynchronus calls(AJAX) to retrieve and re-draw UI components, you may look at XML as an option if your content is static(non-database or user event driven).

Cheers,
Jenkins

9 1802
Pheddy,

I know I'm late here, but if you are still looking for resolution, perhaps this will help. You can use GET or POST variables in the page to create condition filters like so-

hey.asp?view=1

Expand|Select|Wrap|Line Numbers
  1. <%
  2. Dim int_userView As Integer
  3.  
  4. '''Set int_userView = GET variable value
  5. int_userView = Request.QueryString("view")
  6.  
  7. Switch Case int_userView
  8.  
  9.    Case 1
  10.        ptitel="hej"
  11.    Case 2
  12.        body="yeah"
  13.    Case 3 
  14.        pbottom="you read this.."
  15.  
  16. End Select
  17.  
  18. %>
  19.  
  20.  
That's one overly simplistic example. If you are using asynchronus calls(AJAX) to retrieve and re-draw UI components, you may look at XML as an option if your content is static(non-database or user event driven).

Cheers,
Jenkins
Feb 22 '09 #2
Pheddy
80
Thanks i will try that!
It was supposed to work so that I could have one file with three or more textfields easily loaded with Response.Write somefile.asp?something=something . In this way it would be easy to edit and whatnot..
Feb 22 '09 #3
Cool deal. Let me know if that works. If not, give me some more specifics on what you want and we can work towards a more definitive resolution.

Cheers,
Jenkins
Feb 22 '09 #4
Pheddy
80
It dosnt work..
The basics here are that I cant load a file for Response.Write with the arguments of somefile.asp?something=something (ie: Response.Write somefile.asp?something=something.) Or simply call the characters in that file directly by using Server.Exeucute("somefile.asp") and narrow down the line by Server.Execute("somefile.asp?something=something") .. I could use database or ReadLine arguments.. (The readline has the limit it only reads one line, therefor not usable if the character goes beyond 250 or so.)

Just wanted to now if this was possible in some way, because it would be easier for me to write ONE file with three arguments. But I quess ill go for the db way or have three different files with each its characters..

Thanks anyway :D
Feb 22 '09 #5
I'm puzzled now. You could certainly do something like this:


Expand|Select|Wrap|Line Numbers
  1.  
  2. Response.Write "<a href='yoururlhere.asp?urRequestVariableHere=Yourvalue'>Text Name of Link </a>"
  3.  
  4.  
You could do this programmatically and build all components of the href via asp.

It also seems like you might be wanting to make asynchronous calls from what you've described. Are you essentially building the page(HTML) dependent on a user selection?

Another option would be to write out simple tab delimited text files and use FSO to read them.

Give me some more examples of what you are trying to do. DB is a good way to go. But you might easily accomplish the same thing with an XML object and AJAX, then use DHTML to rebuild the DOM. (I am fairly well versed in JS, so if that's the way you need to go, it's no problem.)

Are you trying to make some sort of RSS style story feed?


Let me know if you would like further assistance.

Cheers,
Jenkins
Feb 22 '09 #6
Pheddy
80
Hi..

Nah Jenkins your all wrong.. I wanted to print/display a line from another document. The only way I know off this is by using the Server.Execute("") This displays all character/the whole document. But I thought there might be a way to display precoded blocks from this document by defining a query, but Server.Execute cant send query strings.. Anyway i rounded this problem by using a database..

Thanks all.
(Oh and should there be anyone who has a lead on this, pls post.)


Frederik.
Feb 22 '09 #7
I think I see now. Sorry I wasn't able to help. On last stab(not on a machine with IIS to test, but in theory will work)

Expand|Select|Wrap|Line Numbers
  1.  
  2. <% Your session control here %>
  3.  
  4. <html>
  5. <head>
  6. <title>Defaut Non-Customized Title</title>
  7.  
  8. <script type="text/javascript">
  9. function initiatePage(myuserIdentifier)
  10. {
  11.     var queryString = myuserIdentifier;
  12.     //Your cross browser XML try/catch here
  13.     //innerHTML is used here for simplicity. innerXML may be a better solution 
  14.     //depending on application req
  15.     //You don't have to use asp. you could create a small decision control 
  16.     //via js and direct your calls that way. Receiving files just need to draw html markup or feed text(such as the title)
  17.     if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
  18.     {
  19.  
  20.         //Your asp file would write out the desired title via response.write
  21.                 document.title = xmlHttp.ResponseText;    
  22.  
  23.     }        
  24.  
  25.     xmlHttp.open("GET","yourAspScript.asp"+queryString,true);
  26.         xmlHttp.send(null);
  27.  
  28.  
  29.     //Your next ajax call to build the body via ResponseText or ResponseXML
  30.         //Your receiving asp page could build the div and even handle the db queries
  31.         if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
  32.     {
  33.  
  34.         //Your asp file would write out the desired html markup
  35.                var divControl1 = document.getElementById("customDiv1");
  36.                 divControl1.innerHTML = xmlHttp.ResponseText;    
  37.  
  38.     }
  39.  
  40.        xmlHttp.open("GET","yourAspScript.asp"+queryString+"&pageSection=body",true);
  41.         xmlHttp.send(null);
  42.  
  43. }
  44.  
  45. </script>
  46.  
  47. </head>
  48.  
  49. <%
  50.  
  51. Response.Write "<body onLoad='initiatePage(" & yourSessionPageControlVar & ");'>"
  52.  
  53. Response.Write "<div class='myCSSControl' id='customDiv1' name='customDivSet'></div>"
  54. Response.Write "<div class='myCSSControl' id='customDiv2' name='customDivSet'></div>"
  55. Response.Write "<div class='myCSSControl' id='customDiv2' name='customDivSet'></div>"
  56.  
  57. Response.Write "</body>"
  58.  
  59. %>
  60.  
  61. </html>
  62.  
  63.  
Only limit on querystring length is what the browser is capable of sending via a GET string. If the limit is hit, the POST method could be invoked in the AJAX call to get around that(delimit arrays with "," or something, then use split in asp to create control arrays if needed). So you can use many differentiating variables to determine what content is returned from the XML object.

Essentially you could build a controller that onload calls the conditional page draw(which could be one script that may include db calls if necessary). Then you have two files as document content control.

Best of luck sir,
Jenkins
Feb 22 '09 #8
Pheddy
80
Thanks Jenkins! Nice :D
Feb 23 '09 #9
Glad you like! If you go that route and need any assistance, feel free to let me know and I will assist.
Feb 23 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

20
by: Hung Jung Lu | last post by:
Hi, I know people have talked about it before, but I am still really confused from reading the old messages. When I talk about code blocks, I am not talking about Lisp/Ruby/Perl, so I am not...
1
by: inkapyrite | last post by:
Hi all. I'm using ifstream to read from a named pipe but i've encountered an annoying problem. For some reason, the program blocks on reading an ifstream's internal buffer that's only half-filled....
1
by: Jakob Bieling | last post by:
Hi, whenever I try to read input from stdin, the called function (ie. std::cin.read ()) blocks until my buffer is full. But I want to function to return immediately, regardless of having read...
6
by: Rajorshi Biswas | last post by:
Hi folks, Suppose I have a large (1 GB) text file which I want to read in reverse. The number of characters I want to read at a time is insignificant. I'm confused as to how best to do it. Upon...
3
by: James Dean | last post by:
I create a new filestream and then i move i use the readbyte function and the position function when required. These seem to be cripplingly slow for some reason. This readbyte maybe is the problem....
2
by: Kin | last post by:
I am trying to read the output of an external application using redirected stdout and StreamReader::ReadLine(). The problem is that ReadLine() blocks and I am either reading nothing or just part...
3
by: guanfenglin | last post by:
Hi Guys, I have been reading practises and patterns on MSDN, there is one thing that I am not sure about... There are enterprise library and application blocks, does the latest enterprise...
26
by: brenocon | last post by:
Hi all -- Compared to the Python I know and love, Ruby isn't quite the same. However, it has at least one terrific feature: "blocks". Whereas in Python a "block" is just several lines of...
34
by: Martin | last post by:
I have a question regarding *use* of blocks. In Plauger's THE STANDARD C LIBRARY in xfmtval.c in Chapter 6 I noticed in function _Fmtval() that after some processing of 50 lines or so he creates...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.