PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

Base URL Problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Base URL Problem

    On my intranet I have set up a search function with Zoom.

    There is one page which holds the basic page template and then the rest of the page is built on the fly in ASP depending on the value of a Request.QueryString

    For example

    http://bwbnet2/opm/index.asp?cbofile=chapters/3.htm

    Would load the main template with the menus, banner, search form etc then insert the text of chapter 3. Therefore to make the search function work properly I have to make the base URL

    http://bwbnet2/opm/index.asp?cbofile=
    However when I do this the link that is produced in the search results is

    http://bwbnet2/opm/index.asp?cbofile...ighlight=email

    That is, it's putting a / after the base url which is having a knock on effect to the page that puts everything together.

    What is the best way round this?

    Thanks very much

    Ed

  • #2
    The only possible solution I can find is to edit the zoom_pagedata.zdat file and edit each line so

    http://bwbnet2/opm/index.asp?cbofile...m|Introduction|||

    becomes

    http://bwbnet2/opm/index.asp?cbofile...m|Introduction||||

    NB I have to put an extra | on the end otherwise it seems to chop off characters in the link for the next item in the list.

    This causes its own problems though - if I re-index the file gets over-written and if I copy my version over it may not necessary tie in with the new index as extra pages are added in future.

    Comment


    • #3
      Hi,

      I think it will be easier if I do something like the following in the scriptthat builds the page:

      If MID(Request.QueryString("cbofile"),1,1)="/" Then...
      'Remove first character
      End If

      cheers

      Ed

      Comment


      • #4
        Originally posted by emozley View Post
        For example
        http://bwbnet2/opm/index.asp?cbofile=chapters/3.htm

        Would load the main template with the menus, banner, search form etc then insert the text of chapter 3. Therefore to make the search function work properly I have to make the base URL
        http://bwbnet2/opm/index.asp?cbofile=
        I don't see why that should be the base URL?

        I think the base URL should just be:
        http://bwbnet2/opm/

        Using that as the base URL will not add the extra slash which is breaking your other script. This should solve all your problems from what I can tell.

        And no, do not modify the zoom_pagedata.zdat file. This will break the cross referencing of the index files and lead to unexpected behaviour.
        --Ray
        Wrensoft Web Software
        Sydney, Australia
        Zoom Search Engine

        Comment


        • #5
          Hi,

          If I left the base URL as http://bwbnet/opm it means that if the indexer found a page called 3.htm and produced a link http://bwbnet/opm/3.htm then the user would only see the basic text (ie just the contents of 3.htm). Because I want them to see the banner, the menu and so on I have to stick things together.

          I had to do it this way because you cannot do a dynamic include in asp which is annoying as it has made things rather compicated!

          This fixed it though:

          cboFile=Request.QueryString("cboFile")
          If MID(Request.QueryString("cboFile"),1,1)="/" Then
          cboFile=MID(cboFile,2,LEN(cboFile))
          End If

          And the page that joins everything together is:

          'Pass the name of the file to the function.
          Function getFileContents(strIncludeFile)
          Dim objFSO
          Dim objText
          Dim strPage
          'Instantiate the FileSystemObject Object.
          Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
          'Open the file and pass it to a TextStream Object (objText). The
          '"MapPath" function of the Server Object is used to get the
          'physical path for the file.
          Set objText = objFSO.OpenTextFile(Server.MapPath(strIncludeFile) )
          'Read and return the contents of the file as a string.
          getFileContents = objText.ReadAll
          objText.Close
          Set objText = Nothing
          Set objFSO = Nothing
          End Function
          '-------------------------------------------------------------
          'The "getFileContents" function should be included at the top
          'of the ASP file.
          '-------------------------------------------------------------
          'Declare variables to hold the content of the main page and
          'the include file.
          Dim strMain, strInclude
          'Get the contents of the main page and pass them to the "strMain"
          'variable.
          strMain = getFileContents("maintemplate.asp")
          'Test to see if the "cboFile" select box is being submitted. If so,
          'load the requested include file. If not, load the default include.
          If Request.QueryString("cboFile") = "" Then
          strInclude = getFileContents("chapters/contents.asp")
          Else
          strInclude = getFileContents(cboFile)
          End If
          'After the proper include file contents are loaded ("strInclude"),
          'then insert it into the main page ("strMain") using the "Replace"
          'function.
          strMain = replace(strMain,"<!-- INCLUDE FILE HERE -->",strInclude)
          'Remove hyperlink formating inserted by Word
          strMain = replace(strMain,"a:link, span.MsoHyperlink","")
          strMain = replace(strMain,"{color:blue;", "")
          strMain = replace(strMain,"text-decoration:underline;}", "")
          strMain = replace(strMain,"a:visited, span.MsoHyperlinkFollowed", "")
          'Use the "Response" Object to "Write" the completed page to the client.
          Response.Write strMain

          %>

          cheers

          Ed

          Comment


          • #6
            Originally posted by emozley View Post
            If I left the base URL as http://bwbnet/opm it means that if the indexer found a page called 3.htm and produced a link http://bwbnet/opm/3.htm then the user would only see the basic text (ie just the contents of 3.htm). Because I want them to see the banner, the menu and so on I have to stick things together.
            I'm curious if you actually tried this in practice, and Zoom actually indexed "/opm/3.htm" or is this just what you think will happen? It's difficult for me to reproduce the situation and since your site is not available online, I can't test it easily. But from what I can tell, when Zoom is given a link to something like "http://mysite/test/index.asp?blah=chapters/3.htm", it should actually index that URL as it is, and not locate nor produce a link to "/test/3.htm".

            I can imagine the slash might cause some trouble, but I have not been able to produce any problems relating to this.

            In general, it might be a better idea for your script to handle slashes in an encoded form (eg. %2F), so that there is no chance of confusion by web clients in thinking that the parameters are part of the URL path.

            Nonetheless, if you're happy with the solution you've worked out, then that's good too.
            --Ray
            Wrensoft Web Software
            Sydney, Australia
            Zoom Search Engine

            Comment

            Working...
            X