Re: Smarty news/article admin?
| From: | Monte Ohrt | Date: | Sat, 09 Mar 2002 16:33:49 +0000 |
| Subject: | Re: Smarty news/article admin? | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-2998@lists.php.net to get a copy of this message | ||
Ah. Well take a look at how Smarty does it, you can probably do something similar
or maybe even use the same function.
Peter Bowyer wrote:
> At 03:14 PM 3/8/02 -0600, Monte Ohrt wrote:
> >(untested)
> >
> >preg_match_all("/\[image [^\]]+\]/",$contents,$match);
> >
> >$match[0] should contain an array of your matches. You might just use a
> >preg_replace to get your tags in there.
> >
> >$contents = preg_replace("/\[image id\=([^ ]+)( [^\]]+)?\]/","<img
> >src=\"\\1\"\\2>",$contents);
>
> Thanks, but I was trying to take it one step further and do what Smarty
> does when it passes values to a custom function - so parsing the following tag
> [image id=56 align='left']
> would pass to the defined function an array containing
> id => '56'
> align => 'left'
>
> I'd prefer to do it this way than the one you showed above because this
> gets rid of the problem of quoting attributes in the HTML (it needs to be
> align="left" not align='left' or align=left)
>
> Regards,
> Peter.
>
> ---oOo---
> sendcard - The free PHP e-card solution
> http://sendcard.resource-locator.com
> ---oOo---