有没有办法从tinymce yii查看文本?

时间:2016-01-23 18:32:49

标签: php yii tinymce

每当我使用yii扩展名时,保存输入后它就变成了代码。例如,如果我键入"示例文本"它会显示为

<p>&nbsp;sample text</p>

我想知道是否可以从管理员那里查看它只是纯文本....

有人可以帮忙吗?

这是讽刺 enter image description here

当我保存它时,它看起来像这样,如果可能的话,这就是我想要改变的。

enter image description here

打印出来我使用这段代码:

<h3 class="header">     <?php
if (!$link = mysql_connect('localhost', 'root', '')) {
echo 'Could not connect to mysql';
exit;
}

if (!mysql_select_db('hygeia_master', $link)) {
echo 'Could not select database';
exit;
}

$sql    = 'SELECT title FROM about_histback order by datetime desc limit 1';
$result = mysql_query($sql, $link);

while ($row = mysql_fetch_assoc($result)) {
echo $row['title']."<br>";
}


?>
    <span class="header-line"></span> 
    </h3>
    </div>
    <div class="row-fluid">        

    <div class="span6">
    <?php
if (!$link = mysql_connect('localhost', 'root', '')) {
echo 'Could not connect to mysql';
exit;
}

if (!mysql_select_db('hygeia_master', $link)) {
echo 'Could not select database';
exit;
}

$sql    = 'SELECT historical_background FROM about_histback order by        datetime desc limit 1';
$result = mysql_query($sql, $link);

while ($row = mysql_fetch_assoc($result)) {
echo $row['historical_background']."<br>";
}


?>
</div>

所以显示屏看起来像enter image description here

1 个答案:

答案 0 :(得分:0)

CDetailView为每个属性都有一个类型参数:

$this->widget('zii.widgets.CDetailView', array(
    'data'=>$model,
    'attributes'=>array(
        // First example
        'fieldName:raw', // raw: the attribute value will not be changed at all.
        // Second example
        'fieldName:text', //text: the attribute value will be HTML-encoded when rendering.
        // Third example
        'fieldName:html', // html: the attribute value will be purified and then returned.
        // Fourth example
        array(
            'name' => 'fieldName',
            'type' => 'ntext', // ntext: the formatNtext method will be called to format the attribute value as a HTML-encoded plain text with newlines converted as the HTML <br /> or <p></p> tags.
        ),
    ),
));

您可以在documentation找到更多详细信息,其他列表也支持输出类型。