I tried using Class CMarkdownParser to convert text bbcode to Html text like :
'[b]BB Code[/b]' =====convert====> '<b>BB Code</b>'
the code in class model:
protected function beforeValidate()
{
if(!empty($this->content_text))
{
$purifier=new CHtmlPurifier();
$parser=new CMarkdownParser();
$this->content_text=$parser->transform($this->content_text);
$this->content_html = $purifier->purify($this->content_text);
}
}
and code in view in CDetailView:
<?php $this->widget('zii.widgets.CDetailView', array(
'data'=>$model,
'attributes'=>array(
'title',
array(
'name' => 'categorie_id',
'value' => Categorie::Model()->FindByPk($model->categorie_id)->name,
),
array(
'name'=>'content_html',
'type'=>'raw',
'value'=>$model->content_html,
),
)); ?>
but it dosent currectly:
'[b]BB Code[/b]' =====converted====> <p>[b]BB Code[/b]</p>
While I expect to be below convert and BBcode tag be removed:
'[b]BB Code[/b]' =====convert====> <b>BB Code</b>
I’ve spent too much time to solve this problem and the tools used by yiidecoda, I got an error.
And given that I am a beginner. I’m grateful you explain with an example.
I’m very glad of your help.