Return Only Page Name
It just gets the page name of your page without any slashes or .asp commented for beginners, 4 lines of code. This is a short little snippet I used today on a project, and didn't see anything like it on PSC, so just thought I would share it. Comments welcome.
AI
AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Source Code
<% ScriptName = "/asdfaf/asdf/sfsdf/fas/The_Page_Name.asp" Function GetPageName(sScriptName) '# Location of last slash In ScriptName + 1 because we don't want the slash LastSlashLocation = InstrRev(sScriptName,"/") + 1 '# Location of last period in ScriptName LastDotLocation = InstrRev(sScriptName,".") '# Here we find out how long the page name is ScriptPageNameLength = LastDotLocation - LastSlashLocation '# Start 1 after the forward slash, and end before the period. '# Set it to the function by using the function name GetPageName = Mid(sScriptName,LastSlashLocation,ScriptPageNameLength) End Function '# Call Function Response.Write(GetPageName(ScriptName)) '# Outputs: The_Page_Name %>
Original Comments (3)
Recovered from Wayback Machine