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_r eplace("C:\inet pub\wwwroot\int ranet\", "/", $location);
//Change \ to /...
$location=str_r eplace("\\", "/", $location);
//Output link to $location, named $documentName
print("<a href=\"" . $location . "\">" . $documentName . "</a>\n");
--------------------------- 3 2935
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\wwwr oot\intranet\th eDoc.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=Repla ce(sLocation,"C :\inetpub\wwwro ot\intranet\"," xhttpx://servern
ame/intranet/")
'another alternative
sLocation="xhtt px://servername/intranet/" &
Right(sLocation ,len(sLocation)-instrrev(sLocat ion,"\")) 'untested, but I
think that's right
"Jules" <ju***********@ james-chapman.co.uk> wrote in message
news:63******** *************** ***@posting.goo gle.com... 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_r eplace("C:\inet pub\wwwroot\int ranet\", "/", $location); //Change \ to /... $location=str_r eplace("\\", "/", $location); //Output link to $location, named $documentName print("<a href=\"" . $location . "\">" . $documentName . "</a>\n");
---------------------------
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("S earchString")
CatalogToSearch = "CidSearch"
SearchRankOrder ="rank[d]"
OrigSearch=Sear chString
'
' Create query object
set Q = Server.CreateOb ject("ixsso.Que ry")
set util = Server.CreateOb ject("ixsso.Uti l")
Q.Query = SearchString
Q.Catalog = CatalogToSearch
Q.SortBy = SearchRankOrder
Q.Columns = "DocTitle, vpath, filename, size, write, characterizatio n,
rank, directory, path"
Q.MaxRecords = MaxRecords
'util.AddScopeT oQuery Q, "/cid", "deep"
'
' Do query
'
set RS = Q.CreateRecordS et("nonsequenti al")
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><t d>Doctitle</td><td>Vpath</td><td>Filename </td>"
response.write "<td>Size</td><td>Write</td><td>Characte rization</td><td>Rank</td>"
response.write "<td>Direct ory</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("characteriz ation") & "</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
%>
the vpath is returning the file path? As in, c:\blah blah blah\document.x ls?
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.goo gle.com... 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("S earchString") CatalogToSearch = "CidSearch" SearchRankOrder ="rank[d]" OrigSearch=Sear chString
' ' Create query object
set Q = Server.CreateOb ject("ixsso.Que ry") set util = Server.CreateOb ject("ixsso.Uti l") Q.Query = SearchString Q.Catalog = CatalogToSearch Q.SortBy = SearchRankOrder Q.Columns = "DocTitle, vpath, filename, size, write, characterizatio n, rank, directory, path" Q.MaxRecords = MaxRecords 'util.AddScopeT oQuery Q, "/cid", "deep"
' ' Do query '
set RS = Q.CreateRecordS et("nonsequenti al") 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><t d>Doctitle</td><td>Vpath</td><td>Filename </td>" response.write
"<td>Size</td><td>Write</td><td>Characte rization</td><td>Rank</td>" response.write "<td>Direct ory</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("characteriz ation") & "</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 %> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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. in the first line
I would appreciate it deeply ...
for ($y = 0, $x = $cx-$cy-1; $y <= $cy; ++$y,++$x) {
$prd = $q * $y_ar + $car;
$prd -= ($car = intval($prd / 1E7)) * 1E7;
|
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 -- re.sub('\\\\(.)', '\\\1', s) -- doesn't work, of
course. The best I've come up with so far is a special case for every
character to be translated. There must be an easier way?
--
Henrik S. Hansen http://freecode.dk/~hsh/
|
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 employing XML document to store the
literals and their translations. The literals are passed
as string parameters to a translation routine that picks
up the translated value from the XML. The XML has a ID-
|
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,
but I am stumped at translating
LaTeX character encodings to something XML won't choke on.
I found GNU recode to solve most of this, using
cat milestone.tex | recode -d tex..xml | itemdb -s xml -o milestone.xml
|
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, won't translate
it. When I paste the text into the code, the special characters are
missing. If they would show up there I could use the Replace Special
Characters feature to change it to the proper code, but it won't even
paste into it...
| |
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 should say easiest way for me to do all the
translating?
Thanks in advance.
|
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 a window or not.
My callback function get a long pointer (lParam) to a structure which
contains further information. This structure is described at MSN as follows:
typedef struct tagCREATESTRUCT {
|
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 datagrid using a "select top 1 column 1, column2,
column3 from tblTable" statement. As there will only ever be one row
returned I want to be able to to switch the column names to be row1 and the
column values to be row 2
i.e. select house, street,...
|
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 standard, all
that is covered by this Howto.
http://www.freewebs.com/voipformula/VoIP-HOWTO.html
|
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)
{
int i = 0;
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |