Re: [htdig] Maximum url character size


Subject: Re: [htdig] Maximum url character size
From: christopher.murtagh@wcg.mcgill.ca
Date: Tue Sep 19 2000 - 14:26:31 PDT


 This is from a while back.....

On Thu, 7 Sep 2000, Geoff Hutchison wrote:
>On Thu, 7 Sep 2000, Aaron Avery wrote:
>
>> of the lack of spaces.) Is there currently an option in htdig that will
>> limit a length of the url displayed? ( i.e.
>
>No, though you can certainly edit the code in htsearch/Display.cc

 I had a look at this, and was about to make the changes (it was ugly
though, it would require something like:

vars.Add("SHORTURL", new String(shorturl));

 and something eqiv to:

 strcpy(url, shorturl);

 chop shorturl, and then use $(SHORTURL) in your long.html file....

 I'm still not sure if it would have worked.

 Instead, I found an easier solution, I embeded it into JavaScript so that
my long.html file is as so:

<!-- ITEM -->
<P><SPAN CLASS="subhead"><A HREF="$(URL)">$(TITLE)</A></SPAN>
<BR><SPAN CLASS="smalltype">$(EXCERPT)</SPAN>
<BR><A HREF="$(URL)" CLASS="smalltype">
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
<!--
   var DisplayedURL = '$(URL)';

  if (DisplayedURL.length > 64)
  {
    DisplayedURL = DisplayedURL.substring(0,48) +
                   '<b><tt> ... </tt></b>' +
                   DisplayedURL.substring((DisplayedURL.length - 10), DisplayedURL.length);
  }

     DisplayedURL = DisplayedURL.substring(7, DisplayedURL.length);

  document.write(DisplayedURL);
  
 // -->
</SCRIPT>
</A></P>
<!-- /ITEM -->

The nice thing about this is that I have also removed the http:// from the
URL to match the style of the rest of our web pages.

 To see this in action, go to http://www.mcgill.ca and perform a search
anywhere. A search for the word 'test' will find URLs that are longer than
64 chars.

 Hope this helps.

Cheers,

Chris

-- 

Christopher Murtagh Webmaster / Web Communications Group McGill University Montreal, Quebec Canada

------------------------------------ To unsubscribe from the htdig mailing list, send a message to htdig-unsubscribe@htdig.org You will receive a message to confirm this. List archives: <http://www.htdig.org/mail/menu.html> FAQ: <http://www.htdig.org/FAQ.html>



This archive was generated by hypermail 2b28 : Tue Sep 19 2000 - 14:26:58 PDT