2012-09-10 41 views
1

我正在嘗試激活文本區域的TinyMCE。我的代碼是低於爲文本區域激活Wordpress TinyMCE編輯器

<?php 
wp_editor('', 'content-id', array('textarea_name' => 'txtmessage', 'media_buttons' => false, 'tinymce_adv' => array('width' => '300', 'theme_advanced_buttons1' => 'formatselect,forecolor,|,bold,italic,underline,|,bullist,numlist,blockquote,|,justifyleft,justifycenter,justifyright,justifyfull,|,link,unlink,|,spellchecker,wp_fullscreen,wp_adv'))); 
echo "\r\n"; 
echo "\r\n"; 
echo "\r\n --------Original Message-------- \r\n \r\n"; 
echo "\r\n\r\n".$reply_message_contentmain; 

代碼有效。但是,我的問題是回聲消息顯示在TinyMCE區域的底部和外部。任何建議,如何解決它?我不是一個PHP專家。謝謝,

+0

http://tech-papers.org/wordpress -tinymce_editor/ –

回答

3

wp_editor()的語法是:

<?php wp_editor($content, $editor_id, $settings = array()); ?> 

你已經離開$內容空白和編輯器調用後echo'ing ....所以這樣做:

$content = '\r\n\r\n\r\n--------Original Message-------- \r\n\r\n\r\n' .$reply_message_contentmain 
wp_editor($content, 'content-id', array('textarea_name' => 'txtmessage', 'media_buttons' => false, 'tinymce_adv' => array('width' => '300', 'theme_advanced_buttons1' => 'formatselect,forecolor,|,bold,italic,underline,|,bullist,numlist,blockquote,|,justifyleft,justifycenter,justifyright,justifyfull,|,link,unlink,|,spellchecker,wp_fullscreen,wp_adv'))); 

這應該有效,但我無法從目前的位置進行測試,請告訴我您的行程(但這應該會讓您走上正軌)

+0

Hi Cub3,謝謝。它工作完美。只有一個問題,而不是顯示---原始消息----前後有一個空格,即\ r \ n \ r \ n \ r \ n --------原始消息---- ---- \ r \ n \ r \ n \ r \ n –

+1

更新以下插入換行符前後的換行符---原始消息---- --------Original Message--------
' .$reply_message_contentmain; wp_editor($content, 'content-id', array('textarea_name' => 'txtmessage', 'media_buttons' => false, 'tinymce_adv' => array('width' => '300', 'theme_advanced_buttons1' => 'formatselect,forecolor,|,bold,italic,underline,|,bullist,numlist,blockquote,|,justifyleft,justifycenter,justifyright,justifyfull,|,link,unlink,|,spellchecker,wp_fullscreen,wp_adv'))); ?>
。非常感謝Cube3。 –