作者kpdream (省省力气)
看板PHP
标题[请益] smarty如何崁入文章编辑器
时间Fri Jun 17 00:03:31 2011
之前以news_add.php做好画面
其中要转换成编辑器的部份是
<textarea id="editor1" name="editor1"></textarea>
<?php
include_once "ckeditor/ckeditor.php";
$CKEditor = new CKEditor();
$CKEditor->basePath = 'ckeditor/';
$CKEditor->replace("editor1");
?>
有成功导入'梅问题教学的[CKeditor网页编辑器]'
但转换成smarty的程式与版面分割写法
势必要把之前的画面档news_add.php 转换成news_add.tpl档放在[templates]
此时写在原来画面档的
<?php
include_once "ckeditor/ckeditor.php";
$CKEditor = new CKEditor();
$CKEditor->basePath = 'ckeditor/';
$CKEditor->replace("editor1");
?>
必须拿掉放在smarty写法的news_add.php档中
<?php
include('../lib/main.php');
include_once "ckeditor/ckeditor.php";
$CKEditor = new CKEditor();
$CKEditor->basePath = 'ckeditor/';
$CKEditor->replace("editor1");
$tpl -> assign("editor1",$CKEditor);
$tpl -> display('news_add.tpl.htm');
?>
可是没反应
是因为replace("editor1")替换失败吗
还是哪里出问题呢??
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.219.77.19
※ 编辑: kpdream 来自: 61.219.77.19 (06/17 01:12)
1F:→ derekypp:试看把javascript 前後都加上{literal} ... {/literal} 06/17 01:58
2F:→ derekypp:因为javascirpt大刮号和smarty预设的{$var}冲到了~ 06/17 01:59
3F:→ tkdmaf:何不考虑用纯js版本的ckeditor??? 06/17 07:48
4F:→ kpdream:试着加入之後~发现{literal}被双引号包住了... 06/17 12:32
5F:→ kpdream:成功了~感谢楼上两位大大的提示~^^ 06/17 19:53
6F:→ kpdream:我是用纯js+{literal}完成崁入编辑器^^ 06/17 19:54