|
Posted by Smiley on 04/11/06 00:17
This may not be the best solution, and it's not complete, but this is to
give you a general idea of what I'm thinking:
$lineparts = explode("]]", $pageline);
$lineparts2 = explode("[[", $lineparts[0]);
$pagename = $lineparts2[1];
ereg_replace("[[", "<a href='index.php?page=$pagename'>", $pageline);
ereg_replace("]]", "</a>", $pageline);
Of course, you'd have to modify that to make sure it could handle more than
one set of "[[]]" on a page properly.
<pieterprovoost@gmail.com> wrote in message
news:1144702052.409983.235680@v46g2000cwv.googlegroups.com...
> Hi,
>
> I would like to use the ereg_replace() function to replace wiki-like
> syntax, for example:
>
> [[somepage]]
> becomes <a href="index.php?page=somepage">somepage</a>
>
> **hello**
> becomes <i>hello</i>
>
> The problem with the first example is that "somepage" occurs twice
> after the replacement, the problem with the second example is that the
> opening and closing tags "**" are identical. Can anyone refer me to a
> good page on ereg_replace(), or help me with these examples?
>
> Thanks,
> Pietrer
>
[Back to original message]
|