Hi Guys,
I've been trying to get to grips with PHP now for a few weeks, I'm trying to program a plugin for Joomla since I cant find one that meets my needs.
Anyway.. started to patch some code together that sorta works, although I'm not sure why some of it does!!
My main problem is the parsing stuff -
My joomla content displays the tags {simplei}[url]http://.[/url]. url..{/simplei}
At the mo this code snippet works..
$pattern = '#{simplei}(.*?){/simplei}#s';
if ( !preg_match($pattern, $row->text) ) { return; }
if(preg_match_all($pattern, $row->text, $matches, PREG_PATTERN_ORDER)> 0){
$replace='<img src="'.$matches[1][0].'" width="172" height="172" />';
$row->text = preg_replace( $pattern, $replace , $row->text );
return; }
}
Works well.. strips out the tabs and writes the code to load a piccy from the url.
But what I'd like it to do is return a couple of parameters as well..
so the tag could just be {simplei}[url]http://.[/url]. url..{/simplei}
or it could be {simplei}[url]http://.[/url]. url.. width=30 height=20 frame=2 {/simplei}
It's that darn pattern command and preg_match that I have no idea about!
Can someone please come to my aid! spent close to 3 days trying to get it to work.