473,394 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Help translating PHP to ASP

Is anyone able to translate the following PHP to ASP ? or come up with
something that would work.

The reason for the code is that I'm using Indexing service to create a
search engine on a company intranet. Unfortunately the Find.asp is
bringing back the location of the link as its place on the server (eg
C://Inetpub/www etc rather than a nice URL that works. I've been told
this code may help but its in PHP. Thanks
---------------------------

//Modify location root...
$location=str_replace("C:\inetpub\wwwroot\intranet \", "/", $location);
//Change \ to /...
$location=str_replace("\\", "/", $location);
//Output link to $location, named $documentName
print("<a href=\"" . $location . "\">" . $documentName . "</a>\n");

---------------------------
Jul 19 '05 #1
3 2913
Can you show the asp code you are using?

However, a rough translation---I know nothing of PHP, so I can only guess
this is right.....

'sLocation is the filename of the document--such as
C:\inetpub\wwwroot\intranet\theDoc.doc
'which you want to convert to http://servername/intranet/theDoc.doc

'NOTE: I've set the protocol to xhttpx so that my newsreader doesn't change
it to a hyperlink. Obviously it should be just http

sLocation=Replace(sLocation,"C:\inetpub\wwwroot\in tranet\","xhttpx://servern
ame/intranet/")
'another alternative
sLocation="xhttpx://servername/intranet/" &
Right(sLocation,len(sLocation)-instrrev(sLocation,"\")) 'untested, but I
think that's right


"Jules" <ju***********@james-chapman.co.uk> wrote in message
news:63**************************@posting.google.c om...
Is anyone able to translate the following PHP to ASP ? or come up with
something that would work.

The reason for the code is that I'm using Indexing service to create a
search engine on a company intranet. Unfortunately the Find.asp is
bringing back the location of the link as its place on the server (eg
C://Inetpub/www etc rather than a nice URL that works. I've been told
this code may help but its in PHP. Thanks
---------------------------

//Modify location root...
$location=str_replace("C:\inetpub\wwwroot\intranet \", "/", $location);
//Change \ to /...
$location=str_replace("\\", "/", $location);
//Output link to $location, named $documentName
print("<a href=\"" . $location . "\">" . $documentName . "</a>\n");

---------------------------

Jul 19 '05 #2
Thanks Tom, here's the asp code. Its the DISPLAY RESULTS section
which I'm having a problem with. The PATH and VPATH codes aren't
giving us a nice URL link but the exact path on the C drive.
-----------------

'These lines set the search parameters

FormScope = "/"
PageSize = 1000
MaxRecords=1000
SearchString = Request.Form("SearchString")
CatalogToSearch = "CidSearch"
SearchRankOrder="rank[d]"
OrigSearch=SearchString

'
' Create query object

set Q = Server.CreateObject("ixsso.Query")
set util = Server.CreateObject("ixsso.Util")
Q.Query = SearchString
Q.Catalog = CatalogToSearch
Q.SortBy = SearchRankOrder
Q.Columns = "DocTitle, vpath, filename, size, write, characterization,
rank, directory, path"
Q.MaxRecords = MaxRecords
'util.AddScopeToQuery Q, "/cid", "deep"

'
' Do query
'

set RS = Q.CreateRecordSet("nonsequential")
RS.PageSize = PageSize
response.write "<p>Your search for <b>" & OrigSearch & "</b> yielded "

If RS.RecordCount=0 then response.write "no results."
if RS.RecordCount=1 then response.write "1 result:"
If RS.RecordCount>1 then response.write RS.RecordCount & " results:"

response.write "<table
border=1><tr><td>Doctitle</td><td>Vpath</td><td>Filename</td>"
response.write "<td>Size</td><td>Write</td><td>Characterization</td><td>Rank</td>"
response.write "<td>Directory</td><td>Path</td></tr>"

'Display the results

Do While Not RS.EOF
' loop through the results.
' Build a hyperlink to the document
hlink = "<a href=" & RS("path") & """>" & RS("doctitle") & "</a>"
' Display attributes
response.write "<tr><td>" & hlink & "</td><td>" & RS("Vpath") &
"</td><td>"
response.write RS("filename") & "</td><td>" & RS("size") & "</td><td>"
& RS("write")
response.write "</td><td>" & RS("characterization") & "</td><td>" &
RS("rank")
response.write "</td><td>" & RS("directory") & "</td><td>" &
RS("path") & "</td><tr>"
'Get the next result
RS.MoveNext
Loop 'end of DO WHILE loop

response.write "</table>"
set rs=nothing
set q=nothing
set util=nothing
%>
Jul 19 '05 #3
the vpath is returning the file path? As in, c:\blah blah blah\document.xls?
I've only set up index server once, and that was a while ago, but from what
I recall vpath should return the virtual path, hence the v.

"Jules" <ju***********@james-chapman.co.uk> wrote in message
news:63**************************@posting.google.c om...
Thanks Tom, here's the asp code. Its the DISPLAY RESULTS section
which I'm having a problem with. The PATH and VPATH codes aren't
giving us a nice URL link but the exact path on the C drive.
-----------------

'These lines set the search parameters

FormScope = "/"
PageSize = 1000
MaxRecords=1000
SearchString = Request.Form("SearchString")
CatalogToSearch = "CidSearch"
SearchRankOrder="rank[d]"
OrigSearch=SearchString

'
' Create query object

set Q = Server.CreateObject("ixsso.Query")
set util = Server.CreateObject("ixsso.Util")
Q.Query = SearchString
Q.Catalog = CatalogToSearch
Q.SortBy = SearchRankOrder
Q.Columns = "DocTitle, vpath, filename, size, write, characterization,
rank, directory, path"
Q.MaxRecords = MaxRecords
'util.AddScopeToQuery Q, "/cid", "deep"

'
' Do query
'

set RS = Q.CreateRecordSet("nonsequential")
RS.PageSize = PageSize
response.write "<p>Your search for <b>" & OrigSearch & "</b> yielded "

If RS.RecordCount=0 then response.write "no results."
if RS.RecordCount=1 then response.write "1 result:"
If RS.RecordCount>1 then response.write RS.RecordCount & " results:"

response.write "<table
border=1><tr><td>Doctitle</td><td>Vpath</td><td>Filename</td>"
response.write "<td>Size</td><td>Write</td><td>Characterization</td><td>Rank</td>" response.write "<td>Directory</td><td>Path</td></tr>"

'Display the results

Do While Not RS.EOF
' loop through the results.
' Build a hyperlink to the document
hlink = "<a href=" & RS("path") & """>" & RS("doctitle") & "</a>"
' Display attributes
response.write "<tr><td>" & hlink & "</td><td>" & RS("Vpath") &
"</td><td>"
response.write RS("filename") & "</td><td>" & RS("size") & "</td><td>"
& RS("write")
response.write "</td><td>" & RS("characterization") & "</td><td>" &
RS("rank")
response.write "</td><td>" & RS("directory") & "</td><td>" &
RS("path") & "</td><tr>"
'Get the next result
RS.MoveNext
Loop 'end of DO WHILE loop

response.write "</table>"
set rs=nothing
set q=nothing
set util=nothing
%>

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Davis Marques | last post by:
hi; I'm translating some PHP scripts to Python and have hit a roadblock with a for statement. If someone could explain to me how one should translate the multiple increment, evaluations, etc....
2
by: Henrik S. Hansen | last post by:
How do you best go about translating characters like '\\n' to '\n'? This is for a configuration file parser, where the "backslash convention" is supported. The naive approach --...
0
by: Anuj Mathur | last post by:
Hello All We are making an application for translating the literals (HTML text and labels) of an existing ASP website from English to another language, say Swedish. Now, for this we are...
1
by: Michael Friendly | last post by:
I have a LaTeX document describing a long list of items that I want to translate to XML to treat these as a database. I've written a perl script to do the basic translation, and a basic DTD file,...
23
by: gregf | last post by:
I have a paragraph of text pasted into a word document, it's in Polish, complete with polish characters. They show up just fine in word, but the program I use for web page programming, HomeSite,...
1
by: J | last post by:
Hi all, I just finished a asp.net project, which is based on English language, and all of sudden, client need different language also, say German, Chinese, etc. So, what is the best way, or I...
9
by: Hugo Amselschlag | last post by:
Hi there, I've implemented a local system hook to suppress certain windows beeing displayed by the axWebbrowser control. Now I need some more information before I can decide, whether to suppress...
6
by: Jumping Matt Flash | last post by:
The code i'm writing is using VB .NET and is for a web service returning a dataset, which is in turn to be used by an ASP .NET application displaying a datagrid. I'm currently populating a...
2
by: kimi | last post by:
Voip Learning and Translating Tutorial Voice Over IP is a new communication means that let you telephone with Internet at almost null cost. How this is possible, what systems are used, what is the...
15
by: pinkfog | last post by:
hi,all I write a snippet(in VC6.0 PLATFORM) to show the ASCII character ranging from 0-255. snippet: #include "stdafx.h" #include "stdio.h" #include "conio.h" int main(int argc, char* argv) {...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.