从db读取后,Markitup总是显示html特殊字符

时间:2011-11-15 05:37:51

标签: php javascript markitup

在我的数据库中,我存储的内容如下:

<p>something</p>

然后我将该值加载到markitup编辑器中,但它会一直显示出来

&lt;p&gt;something&lt;/p&gt;

我怎样才能在标记中显示<p>something</p>

设定:

// used for the markitup editor
     mySettings = {
        nameSpace:      'html',
        onShiftEnter:   {keepDefault:false, replaceWith:'<br />\n'},
        onCtrlEnter:    {keepDefault:false, openWith:'\n<p>', closeWith:'</p>'},
        onTab:          {keepDefault:false, replaceWith:'    '},
        markupSet:  [   
            {name:'Heading 2', key:'2', openWith:'<h2(!( class="[![Class]!]")!)>', closeWith:'</h2>', placeHolder:'Your title here...' },
            {name:'Paragraph', openWith:'<p(!( class="[![Class]!]")!)>', closeWith:'</p>'  },
            {name:'Bold', key:'B', openWith:'(!(<strong>|!|<b>)!)', closeWith:'(!(</strong>|!|</b>)!)' },
            {name:'Italic', key:'I', openWith:'(!(<em>|!|<i>)!)', closeWith:'(!(</em>|!|</i>)!)'  },
            {name:'Stroke through', key:'S', openWith:'<del>', closeWith:'</del>' },
            {separator:'---------------' },
            {name:'Bulleted List', openWith:'    <li>', closeWith:'</li>', multiline:true, openBlockWith:'<ul>\n', closeBlockWith:'\n</ul>'},
            {name:'Numeric List', openWith:'    <li>', closeWith:'</li>', multiline:true, openBlockWith:'<ol>\n', closeBlockWith:'\n</ol>'},
            {separator:'---------------' },
            {name:'Picture', key:'P', replaceWith:'<img src="[![Source:!:http://]!]" alt="[![Alternative text]!]" />' },
            {name:'Link', key:'L', openWith:'<a href="[![Link:!:http://]!]"(!( title="[![Title]!]")!)>', closeWith:'</a>', placeHolder:'Your text to link...' },
            {separator:'---------------' },
            {name:'Clean', className:'clean', replaceWith:function(markitup) { return markitup.selection.replace(/<(.*?)>/g, "") } },       
            {name:'Preview', className:'preview',  call:'preview'}
        ]
     }

1 个答案:

答案 0 :(得分:0)

我的html标签转换为特殊字符的原因是因为我在codeigniter form_textarea函数上设置了一个参数。