SV: SV: SV: RE: [PHPLIB] I can't keep the PHPLIB-"cookie" From: Lars S. Geisler (larssg <email protected>)
Date: 11/29/99

[ Good Morning --

This is off the top of my head, but assuming you really have more than 3
URLs to work on (as in your example), here's the sequence:

<UNTESTED CODE>
  [some code...]
</UNTESTED CODE>

Good luck!

Bob. ]

Thank you for your help. I've finally solved the problem with the following
code. I don't know if it's the most effective way to do it, but it works.

// Apply $sess->url() on all links in $Text
Function UrlStr($Text) {
  Global $sess;

  $Continue = 1; $CheckFrom = 0;
  $TempText = $Text;

  While ($Continue == 1) {
    $LinkBegin = StrPos($Text, "<a href=\"", $CheckFrom);
    If ($LinkBegin > 0) {
      $LinkBegin = $LinkBegin + 9;
      $LinkEnd = StrPos($Text, "\">", $LinkBegin);
      If ($LinkEnd > 0) {
        $StrLength = $LinkEnd - $LinkBegin;
        $Address = SubStr($Text, $LinkBegin, $StrLength);
        $NewURL = $sess->url($Address);
        $TempText = Str_Replace($Address, $NewURL, $TempText);
        $Continue = 1;
        $CheckFrom = $LinkEnd;
      } Else {
        $Continue = 0;
      }
    } Else {
      $Continue = 0;
    }
  }

  Return $TempText;
}

Lars Sehested Geisler
larssg <email protected>

-
PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in
the body, not the subject, of your message.