Closed Thread Icon

Topic awaiting preservation: more asp... (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=11908" title="Pages that link to Topic awaiting preservation: more asp... (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: more asp... <span class="small">(Page 1 of 1)</span>\

 
YoBoyE
Nervous Wreck (II) Inmate

From:
Insane since: Sep 2001

posted posted 10-15-2001 22:28

I'm working on the template for my site in ASP right now, and trying to minimize the amount of pages I have to have...seeing as the template will be rather complex (to me at least). So I am doing includes for the navigarion header, etc. But for the content of the site i was wondering how i can do <a hrefs to include things. Basically, being able to have simple files for the includes and being able to somehow link to those includes....so it parses the link into the same page. I'm pretty much trying to make my page function like how many php templates are done...by doing includes and such. This may be too vauge, if so, I'll post a what i mean better. thanks


Eric Hesterman

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 10-16-2001 00:02

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Drakkor
Maniac (V) Inmate

From: Seatte, Warshington, USA
Insane since: Dec 2000

posted posted 10-16-2001 00:09

I'm also a little confused on what you are asking...

To include a link from WITHIN your asp code... (i.e. <% in here %> )
response "<a href='yourlink.html'>text</a>"

To include a link from OUTSIDE your asp code... (i.e. <% code %> out here)
<a href="yourlink.html">text</a>

Note that you can start and stop your code in an asp page as much as you want...
<% code fragment %>
html
html
html
<% more code fragments %>
more html
html
html
<% even more code %>

If you just want to have the server parse another file with your asp page...
End your code before you parse the page, then use SSI include...
<% some asp code %>
<!-- #include file="yourfile.html" -->
<% maybe some more asp code %>

That's it.

-D

chris
Nervous Wreck (II) Inmate

From: Oslo, Norway
Insane since: Jul 2000

posted posted 10-16-2001 00:24

hmz..

do you mean that you always want to link/post to the same page/file but the content differs by what link you press?

If so you can use a the switch/case method (not sure about the syntax in asp)...

this is how i would do it (this is coldfusion):

<cfswitch expression="#url.type#">
<cfcase value="forum">
<cfswitch expression="#url.action#">
<cfcase value="list">
<cfinclude template="./include/query_forum_list.cfm">
<cfinclude template="./include/display_forum_list.cfm">
</cfcase>
</cfswitch>
</cfcase>
</cfswitch>

and the link to display this would then be: forum.cfm?type=forum&action=list

Hope this was what u ment and im not way off...

chris

YoBoyE
Nervous Wreck (II) Inmate

From:
Insane since: Sep 2001

posted posted 10-16-2001 01:43

maybe this will clarify it more...im trying to get the same effect as the template design in php at the gurus network ( http://www.gurusnetwork.com/tutorials/php/phptemplate/phptemplate.html ) but NOT in PHP, instead in ASP. This should be a little more clear. thanks

Eric Hesterman

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 10-16-2001 02:08

YoBoyE: Then it is the code that Drakkor gives at the end of his post:

quote:
<% some asp code %>
<!-- #include file="yourfile.html" -->
<% maybe some more asp code %>



If you want something more specific than that you'll need to post some example code.

Emps


You're my wife now Dave

YoBoyE
Nervous Wreck (II) Inmate

From:
Insane since: Sep 2001

posted posted 10-16-2001 02:31

Emps, I know i can just include a file that way, but i'm not sure I know how to alter it when someone clicks on it... here is the way its done in php...

code:
<?
if ($link == page2){
$page="page2.html";
}
elseif($link == page3){
$page="page3.html";
}
else{
$page="page1.html";
}
?>



by having the above before the <html > tag at the top of the page.... and having the following code where u want the content to be after someone clicks on a link

code:
<? include($page); ?>



oh and a link would look something like....

code:
"<a href="index.php?link=page1"> Page 1 </a>



im pretty sure that is the way it would be in php, but asp is what im going for. thanks, again, heh

[This message has been edited by YoBoyE (edited 10-16-2001).]

chris
Nervous Wreck (II) Inmate

From: Oslo, Norway
Insane since: Jul 2000

posted posted 10-16-2001 09:25

try this.. im a little rusty with vb/asp but here goes...

link : index.asp?whatlink=page1

<%
dim link
dim page
link = request.QueryString("whatlink")

if link = "page1" then
page = "page1.html"
end if

etc...

%>


YoBoyE
Nervous Wreck (II) Inmate

From:
Insane since: Sep 2001

posted posted 10-16-2001 23:29

ok, i have that in an asp page on my server, the URL is http://www.yocentral.net/page.asp . it seems like nothing happens when the link is clicked on, maybe my code is wrong. You can check out the source at http://www.yocentral.net/page.txt also is there a way i can include a certain file depending on the link clicked. thanks

Eric Hesterman

DmS
Paranoid (IV) Inmate

From: Sthlm, Sweden
Insane since: Oct 2000

posted posted 10-17-2001 00:30

Well, this code

code:
<%

dim link
dim page
link = request.QueryString("link")

if link = "page1" then
page = "page1.html"

end if

%>


is not wrong, it's just that you don't do anything else than set a value to a variable, then you should do something with it, the simplest in this case is a redirect based on the value you pass in the query string.
Try this: (all responsibility is hereby declared null and void since this is untested... )

code:
<%

dim link
dim page
link = request.QueryString("link")

if link = "page1" then
page = "page1.html"

' this is the part that actually sends you somewhere...
response.redirect(page)

end if

%>



Beware though, this is not a good way to do this, take it as an example.
If you look at the php-example you posted earlier, the asp should look something like this:

code:
<%

dim link
dim page
link = request.QueryString("link")

select case link
case "page1"
page="page1.html"
case "page2"
page="page2.html"
case "page3"
page="page3.html"
case Else
page = "index.html"

<!-- #include file="page" -->

%>


This code would check the parameter sent in the url against a series of known cases, when it matches it will assign a filename to the variable "page".
Then it will use the variable "page" to represent the filename in the include part. This will include the file that was pointed out in the query string.

Please check the syntax here since I don't have the possibillity to run ASP locally at this point.
Good luck!
-{D}-


-{ a vibration is a movement that doesn't know which way to go }-

[This message has been edited by DmS (edited 10-17-2001).]

[This message has been edited by DmS (edited 10-17-2001).]

YoBoyE
Nervous Wreck (II) Inmate

From:
Insane since: Sep 2001

posted posted 10-17-2001 00:49

That worked perfectly, u can see it at http://www.yocentral.net/page.asp . Also while on the subject how can I have multiple pages specified at the top, instead of just 1, like page1.html... thanks

Eric Hesterman

DmS
Paranoid (IV) Inmate

From: Sthlm, Sweden
Insane since: Oct 2000

posted posted 10-17-2001 00:53

Look above, did some editing while you answered.

To use the redirect thing, just replace the include part.
/Dan


-{ a vibration is a movement that doesn't know which way to go }-

YoBoyE
Nervous Wreck (II) Inmate

From:
Insane since: Sep 2001

posted posted 10-17-2001 02:16

for me, the method you edited your post with, didn't work, it always comes up with a http 500 error (pg cannot be displayed) not sure why. The 1st one works fine, but is there a way to use multiple pages with that one at the top? also, the include thing doesnt work. I need the include to change as people click a link, maybe somethin like index.asp?include=include1 and when someone clicks that link, it would parse the specified page, and for the include have the variable or whatever like <!--#include file="include"--> and the name include would be in the asp, dont know. i prolly just got ya more confused. thanks though

Eric Hesterman

Drakkor
Maniac (V) Inmate

From: Seatte, Warshington, USA
Insane since: Dec 2000

posted posted 10-17-2001 03:17

I still don't know what they hell you are talking about :P guess I need to study up on my giberish.

I think however what you want is one page that has links that change depending on where you are coming from, like on google or any multipage gallery, etc...

So if you are on page 1 of index.asp, you see links to pages 2,3 and 4. But if you are on page 3 of index.asp, you see links to pages 1,2, and 4. Is that what you are asking for? Or perhaps you want all of the links at the top of your page, but want the include to change depending on what link you are pressing?

To do the last thing...

code segment from index.asp...

<%
dim link
dim page
link = request.QueryString("link")
select case link
case "Page1"
page="page1.html"
case "Page2"
page="page2.html"
case "Page3"
page="page3.html"
case "Page4"
page="page4.html"
case Else
page = "page1.html"
end select
%>

<BODY>
<a href="index.asp?link=Page1">Page 1</a>
<a href="index.asp?link=Page2">Page 2</a>
<a href="index.asp?link=Page3">Page 3</a>
<a href="index.asp?link=Page4">Page 4</a>
...
<!-- #include file="<%= page %>" -->

EDIT> This won't work, apparently SSI get's parsed before ASP (suprize suprize!) so if anyone knows how to do this part our man may be in the clear. I'll think about it </EDIT

</BODY>

I have a hunch you were getting a http 500 error because either the include is inside of the <% %> tags, which it cannot be, because include is not valid vb code, or you didn't have an end select statement.



[This message has been edited by Drakkor (edited 10-17-2001).]

[This message has been edited by Drakkor (edited 10-17-2001).]

Drakkor
Maniac (V) Inmate

From: Seatte, Warshington, USA
Insane since: Dec 2000

posted posted 10-17-2001 04:05

Alas, dynamic includes are not available in ASP 2.0 + so you will have to use the file system object after all...

Here's a tutorial for ya..

http://www.asp101.com/articles/michael/dynamicincludes/default.asp

Cheers




[This message has been edited by Drakkor (edited 10-17-2001).]

DmS
Paranoid (IV) Inmate

From: Sthlm, Sweden
Insane since: Oct 2000

posted posted 10-17-2001 23:38

Eric.
Ok, as I wrote, I don't have a way of testing asp locally at this point, but drakkor hit some good points, I did forget the "End Select" after the last "case else" (stupid vb syntax...).

Then to get back to the first question (or second, third, whatever) "How do I make this work as the first example but with multiple choices" well, exchange the include-line for the response.redirect line in the working example above, like this:

code:
<%
dim link
dim page
link = request.QueryString("link")

select case link
case "page1"
page="page1.html"
case "page2"
page="page2.html"
case "page3"
page="page3.html"
case Else
page = "index.html"
End Select

response.redirect(page)

'Then you need the links from drakkor's example to trigger the different cases
%>
<BODY>
<a href="index.asp?link=Page1">Page 1</a>
<a href="index.asp?link=Page2">Page 2</a>
<a href="index.asp?link=Page3">Page 3</a>
<a href="index.asp?link=Page4">Page 4</a>



However, this won't be of any real use (as i see it) since this simply would create a set of links that might just as well be regular html-links...

It would really help us to help you if you explain the scenario a bit, how are you going to use this, where would this fit in in the site, stuff like that.
Right now we are still guessing
/Dan


-{ a vibration is a movement that doesn't know which way to go }-

[This message has been edited by DmS (edited 10-18-2001).]

JayMc Vinney
Neurotic (0) Inmate
Newly admitted

From: largo FL US
Insane since: Oct 2001

posted posted 10-22-2001 17:55

I think that what you are looking for is something like this:

<%

select case request.servervariables("http_referer")

case "page1.asp"
response.redirect ("somepage.asp")
case "page2.asp"
response.redirect("someOtherPage.asp")
case else
response.redirect ("DefaultPage.asp")
end select
%>

Jay McVinney

The ASP FAQ is maintained at http://www.aspfaq.com

Kipstein
Obsessive-Compulsive (I) Inmate

From:
Insane since: Oct 2001

posted posted 10-24-2001 08:12

You would not use SSI for this, as some people have been saying. The line:
<!-- #include file="<%= page %>" -->
will not work, since SSI is parsed before ASP code. The missing link here is the ASP equivalent of the PHP line:
<? include($page); ?>
which does the actual including of the code.

To do that in ASP, you would use:
<% Server.Execute page %>
Other than that, Drakker's code is what you are looking for.

NOTE: This will only work in Windows 2000 - WinNT does not support Server.Execute. There is no way to do this on a WinNT server.

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 03-04-2004 13:26

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

amikael
Bipolar (III) Inmate

From: övik
Insane since: Dec 2002

posted posted 03-04-2004 13:35

http://www.naltabyte.se/liquid

(^-^)b

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 03-04-2004 13:48

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

amikael
Bipolar (III) Inmate

From: övik
Insane since: Dec 2002

posted posted 03-04-2004 14:10

It uses getAndRun() whatever file, and even allows the inclusion of asp-code the same way.
It's really 'acrobatic' when it comes to various types of inclusions/exclusions.
Much more so than anything I've vere seen.

(^-^)b

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 03-04-2004 15:55

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

amikael
Bipolar (III) Inmate

From: övik
Insane since: Dec 2002

posted posted 03-04-2004 16:21

- 2 things.
If I come across as bragging, It's more to do with my english and less to do with me beliving I know it all - because I dont. :-(
Secondly, the samples onsite might be passing pagenames, but that's not required, it's just me being lazy.
Also, all incoming querystrings are thouroughly checked for threats or corrupt data.

(^-^)b

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 03-04-2004 16:57

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

« BackwardsOnwards »

Show Forum Drop Down Menu