Re: SV: SV: RE: [PHPLIB] I can't keep the PHPLIB-"cookie" From: Bob Bowker (bowker <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>
1. load all the URLs into an array:
         $urls => array ("first.com?a=1","second.com?b=a",,,,,)

2. write your function for array_walk:
         function fixit ($address) {
                 $address = $sess->url("$address");
         }

3. fix all the urls:
         array_walk($urls,"fixit");

4. assign the hrefs from the array:
         $i=0;
         <a href=\"" . $urls[$i++] . "\">number 1</a>
         <a href=\"" . $urls[$i++] . "\">number 2</a>
         <a href=\"" . $urls[$i++] . "\">number 3</a>

</UNTESTED CODE>

Good luck!

Bob.

At 12:39 PM 11/28/99 , you wrote:
>[ Hi --
>
>We load all possible URLs into an array, then array_walk a function which
>does the $sess->url assignment. See the PHP docs for array_walk - it's
>fast, and does exactly what you're looking for.
>
>Bob. ]
>
>I understand that and I have now read about array_walk in the manual. Here's
>a sample string - in Danish, but you get the idea:
>
>Så er <a href="arrangementer_vis.php3?nummer=8">CrazyNet 8 (Vamdrup)</a> og
><a href=\"arrangementer_vis.php3?nummer=9\">CrazyNet 9 (Odense)</a> afholdt.
>Vi er ved at planlægge det næste træf (<a
>href=\"arrangementer_vis.php3?nummer=10\">CrazyNet 10</a>), og den
>vejledende dato er 4. - 6. februar, men andet kan endnu ikke oplyses. I
>Vamdrup vil der blive afholdt et CrazyNet Millenium omkring nytår. CNM -
>Årtusindets sjoveste træf!
>
>What do I have to do to change the string into an array that I can
>array_walk the $sess->url on? And how do I convert that back to a string?
>
>
>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.

-
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.