[請益] smarty如何崁入文章編輯器

看板PHP作者 (省省力氣)時間14年前 (2011/06/17 00:03), 編輯推噓0(006)
留言6則, 3人參與, 最新討論串1/1
之前以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)

06/17 01:58, , 1F
試看把javascript 前後都加上{literal} ... {/literal}
06/17 01:58, 1F

06/17 01:59, , 2F
因為javascirpt大刮號和smarty預設的{$var}衝到了~
06/17 01:59, 2F

06/17 07:48, , 3F
何不考慮用純js版本的ckeditor???
06/17 07:48, 3F

06/17 12:32, , 4F
試著加入之後~發現{literal}被雙引號包住了...
06/17 12:32, 4F

06/17 19:53, , 5F
成功了~感謝樓上兩位大大的提示~^^
06/17 19:53, 5F

06/17 19:54, , 6F
我是用純js+{literal}完成崁入編輯器^^
06/17 19:54, 6F
文章代碼(AID): #1D-YbLnw (PHP)
文章代碼(AID): #1D-YbLnw (PHP)