您的位置:首页 > 数据库

百度编辑器使用 嵌入ci (可灵活运用,建立数据库,写入并读出,实现用户自定义网页页面内容)

2015-04-21 17:51 1011 查看


1、下载源码 http://ueditor.baidu.com/website/download.html
2、嵌入页面

3、接收传递,显示输出

(2、

<script type="text/javascript" src="<?=base_url()?>../bootstrap/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="<?=base_url()?>../bootstrap/js/ueditor/ueditor.all.js"></script>
<link rel="stylesheet" href="<?=base_url()?>../bootstrap/js/ueditor/themes/default/dialogbase.css"/>

<script type="text/javascript">
//var URL= "<?=base_url().'application/views/default/'?>";
var editor = new baidu.editor.ui.Editor();
editor.render("myEditor");

//alert(editor.getContent()) ;

</script>

<form action="<?=base_url()?>admin/content" method="post" id="myFormID" >
<script type="text/plain" id="myEditor" name="myEditor">

</script>

<input type="submit" name="submit" value="提交">

</form>


3、接收 输出

public function content(){

$content = $_POST['myEditor'];;
echo "--------------------------"."<br>";
echo htmlspecialchars($content);  //源码输出
//echo $content;
}




====================================================================

1、建立数据库



2、存入上边3的内容

public function content(){

$content = $_POST['myEditor'];;
echo "--------------------------"."<br>";
echo htmlspecialchars($content);
$query = $this->Match_model->add_matchinfo(htmlspecialchars($content));

var_dump($query);
//echo $content;
}


3、显示自定义页面

控制层

$matchRules =  $this->Match_model->get_matchinfo();
$data['matchRules'] = $matchRules;

$this->load->view('head');
$this->load->view('m_clubindex',$data);
$this->load->view('foot');


显示层 页面都是utf-8

<?php
//var_dump($matchRules);
if($matchRules){
//echo htmlentities($matchRules['matchdate']);
echo html_entity_decode($matchRules['matchdate']);
}
?>


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐