simple replacment with regex - problem - Joomla! Forum - community, help and support
hi!
i tried write simple replacement plugin j1.5, replace text between {mytext} {/mytext} html, error:
parse error: syntax error, unexpected t_variable, expecting '{' in /home/techniczne/www/html/kreatywwwny/plugins/content/reqreplace.php on line 14
my plugin code:
where problem? ideas?
thanks!
i tried write simple replacement plugin j1.5, replace text between {mytext} {/mytext} html, error:
parse error: syntax error, unexpected t_variable, expecting '{' in /home/techniczne/www/html/kreatywwwny/plugins/content/reqreplace.php on line 14
my plugin code:
code: select all
<?php
defined( '_jexec' ) or die( 'restricted access' );
$_mambots->registerfunction( 'onpreparecontent', 'plugreplacer' );
function plugreplacer( $published, $row, $params, $page=0 )
$regex = "{mytext}(.*?){/mytext}";
$row->text = preg_replace_callback( $regex, 'run_replacer', $row->text );
return true;
}
function run_replacer( &$matches ) {
$text = $matches[1];
$text = "<b>$text</b>";
return $text;
}
?>
where problem? ideas?
thanks!
the left curly bracket missing function definition:
code: select all
function plugreplacer( $published, $row, $params, $page=0 ) {
Comments
Post a Comment