View Full Version : conditional asp
code blue
05-15-2006, 07:46 AM
Hi.
i am relatively new to using asp, so far only using it for including common bits of code on multiple pages.
i have been tolf that it is possible to create a navigation system where only 1 asp include file is used as the navigation for the whole site, and using conditional asp statements allows it to always work correctly, no-matter what page it's working from (regardless of how many folders up/down in the site structure it sits)
can anyone point me in the right direction for this? I have googled and been unable to find any good tutorials or other info for a beginner to asp.
thanks.
degsy
05-15-2006, 03:13 PM
Use the path from the webroot.
e.g.
<!--#include virtual="/includes/file.ext" -->
code blue
05-16-2006, 01:05 AM
hi Degsy - thanks, but that's not really what i'm looking for...
i can do includes, and i do use "include virtual" to reference from the webroot, but what i'm looking is ways of using the same code on all pages but getting a slightly different result out of it. eg.
i want to use one include file for the navigation on all pages in one section of the site, but i also want to have somnething to highlight what the current page is within that navigation... is there a way that the nav can have a function built into it that checks what page it's on now and highlights the relevant nav item?
is it possible to do this?
cn anyone give me some pointers as to where to look for some good infor on stuff like this??
Archangel
05-16-2006, 12:04 PM
You just use variable like you normally would. Before you include your navigation menu you could say something like
page = "AboutUs"
Then include your navigation...
<!--#include virtual="/includes/navigation.asp" -->
And in the Navigation just check and if page = "AboutUs" display the "About Us" tab in a different style.
When you include a file it's like that code is on the page so you can interact it dynamically with the page it is being included to as long as the variables it gets its info from are located above where it is included. Same thing...you can set variables in the include and they can be accessed on the main page below where the file is included.
code blue
05-17-2006, 12:56 AM
ahhh thanks archangel - thats the sort of thing i was after... so it is possible!
Do you know of any good asp tutorial sites that might cover this sort of thing?
Only reason i ask, is ive been able to find plenty of sites that give good explainations on things like html, css and actionscript/flash, but have not been able to find any good beginner type stuff on asp.
cheers.
vBulletin® v3.8.2, Copyright ©2000-2010, Jelsoft Enterprises Ltd.