Help!!
I've been trying to put together a joomla plugin of my own as I cant find one that meets my needs. At the moment, the code I've cobbled together does work:
I'm trying to parse for tags in my content page: {simplei}http://..url{/simplei}
Here's part of the listing..
$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;
}
it works, but I'd like to parse a couple of variables too, this is what I'd like it to parse for.. (it must also know that sometimes there wont be any vars, just the url!)
{simplei}http://..url width=33 height=23 frame=1{/simplei}
So really, I want to parse not just for the url, but the optional 3 other vars!
But I'm admitting defeat.. spent days and days trying to work out preg_match, just cant get my head around how it works!
Can someone please help me out?.