1)

function filter() {

  if($this->post['a'] == "savenews") {
   $this->post['summary'] = preg_replace("!\[url\](.*)\[/url\]!","<a
href=\"\\1\">\\1</a>", $this->post['summary']);
}

-----------------------

2)

global $nwedst;
$nwedst = str_replace("<br>\n", '', $dat->summary);
nwedst = preg_replace("!\<a
href=\"http://(.*)\">(.*)\</a>!","[url]http://\\1[/url]";, $nwedst);




1 takes a full news post and changes [url]...[/url] into <a
href="...">...</a> and saves the news post
2 takes the full news post and recalls it, changes <a href="...">...</a>...
into [url]...[/url]


1 is used when making a new news post, 2 is used when editing a news post
(making the post user friendly and easy to edit)

2 seems to only replace the first <a href="..."> and the last </a> when
there are multiple links.  That's the first of my problems.  The second is
that I would like to change my code so that it changes [url="$1]$2[/url]
into <a href="$1">$2</a>  and back again but i don't know how to change
multiple things with preg_replace().


plz help,
Darkstar

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to