Re: Smarty news/article admin?

From: Date: Fri, 08 Mar 2002 21:14:46 +0000
Subject: Re: Smarty news/article admin?
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-2986@lists.php.net to get a copy of this message
(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); Peter Bowyer wrote: > > At 10:05 AM 3/8/02 -0600, Monte Ohrt wrote: > >If it is static article content, use a prefilter to parse your template. > > It's stored in a database, so it's not quite that simple :-) > Looks like I'll have to use the cache although I prefer not to. Otherwise > I can't see any way of prefiltering the contents. > > >Parsing is an expensive operation, so make it happen once at compile > >time. I assume you need this parsing so that your content doesn't need > >to contain the actual HTML entities to create a link? > > Yes, it will have support for the bb/wiki tags beloved by some - some of > which are even useful ;). By not allowing HTML in the articles I can > prevent cross-site scripting attacks and it allows me to convert all > entities easily, although for more experienced and trusted posters HTML > will be enabled. The most important tag is the one to get images from the > photo gallery/image catalogue into the articles/news - the image tag I put > in the last email,and it's the parsing of this tag I'm having problems > with. I need to get the id and any other attribute out of any of the > following: > [image id=46] > [image id=46 align=left] > [image align=right id=46] > > Suggestions? My regex knowledge sucks - I have Jeffrey Friedl's book, but > haven't got further than chapter 4 yet. > > Thanks, > Peter. > > --oOo-- > Narrow Gauge on the web - photos, directory and forums! > http://www.narrow-gauge.co.uk > --oOo-- > Glenbranter - Scottish narrow gauge in 009 > http://glenbranter.narrow-gauge.co.uk > --oOo-- -- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.

« previous php.smarty.general (#2986) next »