I use BBCode Helper. helper code:
function parse_bbcode($str = ''){
$find = array(
"'\[v\](.*?)\[/v\]'is"
);
$replace = array(
'<video>\1</video>'
);
return preg_replace($find, $replace, $str);
}
controller:
$this->load->helper('bbcode');
$data['news'] = $this->news_model->get_news($config['per_page'], $this->uri->segment(3, 1));
foreach ($data['news'] as $key=>$val)
{
parse_bbcode($data['news'][$key]['description']);
}
for example i want to replace [v]vid[/v] to vid. replacement does not work (nothing happens). what I did wrong?