It seems the following code works for the cropping of the URL....you just
change the $DU variable to $PRINTURL where you wanted the cropped version to
be "replaced"...it also adds a "..." after it to show that its not the full
URL:

$cropvalue="75";

    if ($lang_url_translation == 'yes') {
        $nolangurl = ereg_replace("\.[a-z]{2}\.[a-z]{2,4}$", "", $url);
        $str=ereg_replace('\$DU', $nolangurl, $str);
        if (strlen($nolangurl) > $cropvalue)
        {

$str=ereg_replace('\$PRINTURL',(substr($nolangurl,0,$cropvalue)) .
"...",$str);
        }
        else
        {
                $str=ereg_replace('\$PRINTURL',$nolangurl,$str);
        }
    } else {
        $str=ereg_replace('\$DU', $url, $str);
        if (strlen($url) > $cropvalue)
        {
                $str=ereg_replace('\$PRINTURL',(substr($url,0,$cropvalue)) .
"...",$str);
        }
        else
        {
                $str=ereg_replace('\$PRINTURL',$url,$str);
        }
    }



----- Original Message -----
From: Den <[EMAIL PROTECTED]>
To: Matt Juszczak <[EMAIL PROTECTED]>
Sent: Tuesday, August 28, 2001 6:32 AM
Subject: Re[2]: Webboard: Limiting length of URL


> Hello Matt,
>
> Tuesday, August 28, 2001, 1:15:18 PM, you wrote:
>
> MJ> I use the PHP front end....and I know PHP...but I assume there is no
way
> MJ> of including PHP code in the search.htm (template) to do some kind of
> MJ> substr() function to cut the length short?
>
> This is $DU var in search.htm
> so... seek $DU in template.inc
> Found!
> next change 3 lines from:
>
> $str=ereg_replace('\$DU', $nolangurl, $str);
>     } else

>         $str=ereg_replace('\$DU', $url, $str);
>
> to:
>
> $str=ereg_replace('\$DU', substr($nolangurl,0,50), $str);
>     } else

>         $str=ereg_replace('\$DU', substr($url,0,50), $str);
>
> that's all!
>
> MJ> -Matt
>
> MJ> On 28 Aug 2001, Alexander Barkov wrote:
>
> >> Author: Alexander Barkov
> >> Email: [EMAIL PROTECTED]
> >> Message:
> >> > Hello.
> >> >
> >> > I was just wondering if ther was a way with mnogosearch to limit the
length of a URL.  In other words, right now a standard listing would print
the following to the screen:
> >> >
> >> > 1. Mydomain.com - /Music/Crash Test Dummies/Wallpapers
> >> >
http://www.mydomain.com/index.php?dir=%2FMusic%2FCrash+Test+Dummies%2FWallpa
pers
> >> >
> >> > As you can see, those URL's get mighty long...and a LOT of them are
longer...and they've been pushing off the side of the screen and creating a
scroll bar...and I dont want to do that.  Is there
> >> anyway to say &quot;Only print the first 100 characters&quot; of the
URL?  So a listing might look like....
> >> >
> >> > 1.  mydomain.com - contact page
> >> >     http://www.mydomain.com/50_more_characters_or_so....
> >> >     Mon, 27 Aug 2001 05:53:51 EDT, 27456 bytes
> >> >
> >>
> >> Currently it is not possible. However it is nice feature for TODO.
> >> I think we'll implement it in 3.2.0 final release.
> >>
> >> BTW, Which frontend do you use? PHP, Perl or search.cgi?
> >>
> >>
> >> Reply: <http://www.mnogosearch.org/board/message.php?id=2950>
> >>
> >> ___________________________________________
> >> If you want to unsubscribe send "unsubscribe general"
> >> to [EMAIL PROTECTED]
> >>
> >>
>
> MJ> ___________________________________________
> MJ> If you want to unsubscribe send "unsubscribe general"
> MJ> to [EMAIL PROTECTED]
>
>
>
>
> --
> Best regards,
>  Den                            mailto:[EMAIL PROTECTED]
>
>
> ___________________________________________
> If you want to unsubscribe send "unsubscribe general"
> to [EMAIL PROTECTED]
>
>

___________________________________________
If you want to unsubscribe send "unsubscribe general"
to [EMAIL PROTECTED]

Reply via email to