|
Post by Jerry Muelver on Sept 21, 2007 20:19:11 GMT -5
How do I use UrlKeys$? I show a page with a couple of HTML links in it, wait for the viewer to click on a link, and then.... ? Can I grab UrlKeys$ and extract its contents or value after a link click?
Or, is there a way to use a generic processing handler for all links:
[tryagain] link #linkhandle, "One", [dolinks] link #linkhandle, "Two", [dolinks]
[dolinks] print "The value of the calling link is "; #linkhandle contents$() goto [tryagain]
or somesuch. I've got a 50-page document with a couple hundred links, and don't want to have to create a separate handler for each link. I thought UrlKey$ was going to be my salvation.
|
|
|
Post by Jerry Muelver on Sept 21, 2007 21:01:38 GMT -5
Never mind -- I got it: [tryagain] link #one, "One", linker html " " link #two, "Two", linker #two setkey("This is two") html " " link #quit, "Quit", linker #quit setkey("All done!") print wait
sub linker key$ print key$ if key$ = "#quit" then end end sub
Still, it would be nice to know how to use UrlKeys$....
|
|
Chris Iverson
Junior Member
There are many worlds, but they all share the same sky. One sky, one destiny.
Posts: 73
|
Post by Chris Iverson on Sept 21, 2007 22:24:28 GMT -5
UrlKeys$ is for data passed to the application through the URL, the stuff after the question mark. E.g. if you had a runbasic app named 'login', and it accepted data for 'username' and password', the URL would be:
http://localhost:8008/seaside/go/runbasicpersonal?app=login&username=me&password=secret
UrlKeys$ would hold this:
"app=login&username=me&password=secret"
EDIT: I'll post a demo tomorrow, I'm tired.
|
|
|
Post by Jerry Muelver on Sept 21, 2007 22:25:13 GMT -5
Well, I almost have it. I still have a problem. I have to be able to generate handles dynamically, one handle for each link on the page, so I know which link is activating the generic handler sub. Like:
a$ = "PageOne" link #a$, a$, linker
Can I have a handle array? #a(1), #a(2), etc.?
|
|
|
Post by Jerry Muelver on Sept 21, 2007 22:27:28 GMT -5
UrlKeys$ is for data passed to the application through the URL, the stuff after the question mark. Whoops. I had it backwards, and thought UrlKeys$ had the data being passed by the clicked link. Old habits, from a previous language.
|
|
|
Post by carlgundel on Sept 21, 2007 22:56:35 GMT -5
Well, I almost have it. I still have a problem. I have to be able to generate handles dynamically, one handle for each link on the page, so I know which link is activating the generic handler sub. Like: a$ = "PageOne" link #a$, a$, linker
Can I have a handle array? #a(1), #a(2), etc.? You can set the key of each link, like this. linkNames$ = "apple cheese brocolli" for x = 1 to 3 a$ = word$(linkNames$, x) link #1, a$, genericRoutine #1 setkey(a$) print next x wait
sub genericRoutine key$ if key$ = "apple" then print "iPhone" if key$ = "cheese" then print "stinky" if key$ = "brocolli" then print "eat your veggies" end sub Does this help? -Carl
|
|
|
Post by Brent on Sept 22, 2007 2:28:20 GMT -5
BTW, It should be pointed out that you should never pass login information to an app using the URL. If a computer is public, others could get that info from the browser's history. Also, someone could make a link to a site they control and try to get you to click on it after logging in, thus sending your info in the referrer URL to be picked out of a logfile.
|
|
|
Post by Jerry Muelver on Sept 22, 2007 6:28:17 GMT -5
Carl, yup, that's it! I thought I had to set the key for each HANDLE, and didn't think it would stick if set for each KEY! I have to golf today, so developing my app with this last missing link will have to wait a day or so. But I figure by the end of October, word of my RBPager will have leaked out to Google, and they'll be begging to buy me out.
|
|
Chris Iverson
Junior Member
There are many worlds, but they all share the same sky. One sky, one destiny.
Posts: 73
|
Post by Chris Iverson on Sept 22, 2007 17:51:25 GMT -5
I wouldn't use the URL method of passing data for something like a username and a password. I just needed an example.
Since my site would most likely be written in RB, I'd just have 'login' as a module with a Login() function, and directly pass the data to it.
|
|