vPath cutting off path location name?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • zz12

    vPath cutting off path location name?

    Hello. We have a SearchResults.a sp page that returns a list of asp pages
    that are associated with the user's search parameters that they type in in a
    search page called something like Search.asp. We noticed that the last line
    in the following rs("vpath") value lists the path up until the first blank
    of either a folder or file name and cuts off the rest of the path's text
    name. Does anyone know how to have the vpath list the entire path name even
    including spaces if there are any?

    <%
    Dim sSearchString
    Dim oQuery

    sSearchString = Request.Form("q uery")

    Const SEARCH_CATALOG = "web" 'remember to change this

    Set oQuery = Server.CreateOb ject("IXSSO.Que ry")
    oQuery.Catalog = SEARCH_CATALOG
    oQuery.Query = "@all " & sSearchString & " AND NOT #path *_* AND NOT #path
    *downloads* AND NOT #path *images* AND NOT #filename *.class AND NOT
    #filename *.asa AND NOT #filename *.css AND NOT #filename *postinfo.html"
    oQuery.MaxRecor ds = 200
    oQuery.SortBy = "rank[d]"
    oQuery.Columns = "DocAuthor, vpath, doctitle, FileName, Path, Write, Size,
    Rank, Create, Characterizatio n, DocCategory"
    Set rs = oQuery.CreateRe cordSet("nonseq uential")

    Response.write "<a href=" & rs("vpath") & "<font color='#49698D' size='2'
    style='arial'>< b>" & rs("doctitle") & "</b></font></a><br>"
    %>

    Thanks in advance.


  • Daniel Crichton

    #2
    Re: vPath cutting off path location name?

    zz12 wrote on Wed, 13 Jun 2007 16:41:08 -0700:
    Hello. We have a SearchResults.a sp page that returns a list of asp pages
    that are associated with the user's search parameters that they type in in
    a search page called something like Search.asp. We noticed that the last
    line in the following rs("vpath") value lists the path up until the first
    blank of either a folder or file name and cuts off the rest of the path's
    text name. Does anyone know how to have the vpath list the entire path
    name even including spaces if there are any?
    >
    <%
    Dim sSearchString
    Dim oQuery
    >
    sSearchString = Request.Form("q uery")
    >
    Const SEARCH_CATALOG = "web" 'remember to change this
    >
    Set oQuery = Server.CreateOb ject("IXSSO.Que ry")
    oQuery.Catalog = SEARCH_CATALOG
    oQuery.Query = "@all " & sSearchString & " AND NOT #path *_* AND NOT #path
    *downloads* AND NOT #path *images* AND NOT #filename *.class AND NOT
    #filename *.asa AND NOT #filename *.css AND NOT #filename *postinfo.html"
    oQuery.MaxRecor ds = 200
    oQuery.SortBy = "rank[d]"
    oQuery.Columns = "DocAuthor, vpath, doctitle, FileName, Path, Write, Size,
    Rank, Create, Characterizatio n, DocCategory"
    Set rs = oQuery.CreateRe cordSet("nonseq uential")
    >
    Response.write "<a href=" & rs("vpath") & "<font color='#49698D'
    size='2' style='arial'>< b>" & rs("doctitle") & "</b></font></a><br>"
    %>
    You need to put quotes around the path, and I'd recommend URL encoding them
    too. For completeness I'd also recommend HTML encoding doctitle just in case
    there are any characters that might cause problems (however, if you know
    this is already in HTML format you can remove the Server.HTMLEnco de function
    call)

    Response.write "<a href=""" & Server.URLEncod e(rs("vpath")) & """<font
    color='#49698D'
    size='2' style='arial'>< b>" & Server.HTMLEnco de(rs("doctitle ")) &
    "</b></font></a><br>"

    Notice the "" before and after the path value, this writes a " at those
    positions

    That should do it. The reason the path was being cut at the space is because
    without the href value being quote the browser has to use spaces as the
    attribute delimiters, eg.

    <a href=my path>

    the href value becomes "my", because "path" could be another attribute name.
    If you had

    <a href="my path">

    then the browser will know that "my path" is the entire path. However,
    spaces in URLs are not allowed, so you do this:

    <a href="my+path">

    and everthing works properly. Server.URLEncod e will do all the work of
    ensuring that the vpath value is correctly presented for URL use, replacing
    all non-legal chars with URL entities.

    Dan


    Comment

    • zz12

      #3
      Re: vPath cutting off path location name?

      That fixed it. You are awesome. Thanks a bunch Daniel. Much appreciated.

      Take cares :)


      "Daniel Crichton" <msnews@worldof spack.comwrote in message
      news:OTxJJFmrHH A.2240@TK2MSFTN GP03.phx.gbl...
      zz12 wrote on Wed, 13 Jun 2007 16:41:08 -0700:
      >
      >Hello. We have a SearchResults.a sp page that returns a list of asp pages
      >that are associated with the user's search parameters that they type in
      >in
      >a search page called something like Search.asp. We noticed that the last
      >line in the following rs("vpath") value lists the path up until the first
      >blank of either a folder or file name and cuts off the rest of the path's
      >text name. Does anyone know how to have the vpath list the entire path
      >name even including spaces if there are any?
      >>
      ><%
      >Dim sSearchString
      >Dim oQuery
      >>
      >sSearchStrin g = Request.Form("q uery")
      >>
      >Const SEARCH_CATALOG = "web" 'remember to change this
      >>
      >Set oQuery = Server.CreateOb ject("IXSSO.Que ry")
      >oQuery.Catal og = SEARCH_CATALOG
      >oQuery.Query = "@all " & sSearchString & " AND NOT #path *_* AND NOT
      >#path
      >*downloads* AND NOT #path *images* AND NOT #filename *.class AND NOT
      >#filename *.asa AND NOT #filename *.css AND NOT #filename *postinfo.html"
      >oQuery.MaxReco rds = 200
      >oQuery.SortB y = "rank[d]"
      >oQuery.Colum ns = "DocAuthor, vpath, doctitle, FileName, Path, Write,
      >Size,
      >Rank, Create, Characterizatio n, DocCategory"
      >Set rs = oQuery.CreateRe cordSet("nonseq uential")
      >>
      >Response.wri te "<a href=" & rs("vpath") & "<font color='#49698D'
      >size='2' style='arial'>< b>" & rs("doctitle") & "</b></font></a><br>"
      >%>
      >
      You need to put quotes around the path, and I'd recommend URL encoding
      them too. For completeness I'd also recommend HTML encoding doctitle just
      in case there are any characters that might cause problems (however, if
      you know this is already in HTML format you can remove the
      Server.HTMLEnco de function call)
      >
      Response.write "<a href=""" & Server.URLEncod e(rs("vpath")) & """<font
      color='#49698D'
      size='2' style='arial'>< b>" & Server.HTMLEnco de(rs("doctitle ")) &
      "</b></font></a><br>"
      >
      Notice the "" before and after the path value, this writes a " at those
      positions
      >
      That should do it. The reason the path was being cut at the space is
      because without the href value being quote the browser has to use spaces
      as the attribute delimiters, eg.
      >
      <a href=my path>
      >
      the href value becomes "my", because "path" could be another attribute
      name. If you had
      >
      <a href="my path">
      >
      then the browser will know that "my path" is the entire path. However,
      spaces in URLs are not allowed, so you do this:
      >
      <a href="my+path">
      >
      and everthing works properly. Server.URLEncod e will do all the work of
      ensuring that the vpath value is correctly presented for URL use,
      replacing all non-legal chars with URL entities.
      >
      Dan
      >

      Comment

      Working...