|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Including Menu In Certain Directories
I'm including a template on all pages in a site. In the template I have a menu. What I'd like is to have a different menu displayed if I'm in a different directory.
Something along the lines of: If path is /mainsite Then Regular Menu If path is /admin Then Admin Menu Just not sure about how to go about getting there. My first thought was to use the PATH_INFO server variable, but that returns the page name too. Any suggestions? |
|
#2
|
|||
|
|||
|
For getting a path use server.Mappath()
depending how you setup your website you can also use server side inludes ie. <!--#include file="page.asp"--> and <!--#include virtual="page.asp"--> The virtual include will require extra server setup to work properly
__________________
-- ngibsonau |
|
#3
|
||||
|
||||
|
you could also use the
Request.ServerVariables("SCRIPT_NAME") which will give a full path of the current page, starting at the root of the server "/" and you could use that to parse it and put all the if staments that u want I hope this is of any help. |
|
#4
|
|||
|
|||
|
Thanks guys.
Looks like I really need to practice my If Then Statements. I'm trying to do this without a page name, because there are many pages in each directory. Although not the exact method I hoped to use, I did get the intended effect by just creating a variable called ShowMenu, then setting that to 1 on each page I want the menu to display on. If you could show me a better way than I've done, it would be appreciated. Thanks again for your suggestions. |
|
#5
|
|||
|
|||
|
Try this code on for size.
Code:
<%
dim strPath
dim intPos
strPath = lcase(Request.ServerVariables("SCRIPT_NAME"))
intPos = Instr(1,strPath,"/admin/")
If intPos > 0 Then
response.write("Admin")
else
response.write("Other")
end if
%>
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Including Menu In Certain Directories |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|