2013-06-12 56 views
1

提前感謝大家的幫助。將內容加載到TinyMCE中

我想將內容加載到TinyMCE文本字段中。

我的代碼如下所示:?

<?php 
    require_once('adminmenu.php'); 
    $articleid = $_GET['id']; 
    require_once('core/dbconnect.php'); 

    $qarticles = mysql_query("SELECT * FROM news WHERE id='$articleid' ORDER BY date DESC"); 
    $row = mysql_fetch_array($qarticles); 
    $date = $row['date']; 
    $title = $row['title']; 
    $shorttitle = $row['shorttitle']; 
    $content = $row['content']; 
    ?> 

    <script src="http://tinymce.cachefly.net/4.0/tinymce.min.js"></script> 
    <script> 
     tinymce.init({selector:'textarea'}); 
    </script> 

    <form name="form" method="post" action="articleedit.php?id=<?php echo $id; ?>" onsubmit="return confirm('Are you sure you want to change article?')"> 
     <p> 
      <label for="newsmgstitle"></label> 
      <label for="newsmsgdatetime"></label> 
     </p> 
     <table border="0"> 
      <tr> 
       <td colspan="2" bgcolor="#000000" style="font-weight: bold; color: #FFF;">NEW NEWS ARTICLE</td> 
      </tr> 
      <tr> 
       <td><strong>TIME & DATE</strong></td> 
       <td><input type="text" name="newsmsgdatetime" id="newsmsgdatetime" size="25" value="<?php echo $date; ?>"</td> 
      </tr> 
      <tr> 
       <td><strong>TITLE</strong></td> 
       <td><input type="text" name="newsmgstitle" id="newsmgstitle" size="50" value="<?php echo $title; ?>"></td> 
      </tr> 
      <tr> 
       <td><strong>SHORT TITLE</strong></td> 
       <td><input type="text" name="newsmsgshortitle" id="newsmsgshortitle" size="25" maxlength="25" value="<?php echo $shorttitle; ?>"></td> 
      </tr> 
      <tr> 
       <td colspan="2"><strong>ARTICLE</strong><br> 
        <textarea name="newsmsg" id="newsmsg" cols="80" rows="20" value="<?php echo $content; ?>"></textarea></td> 
      </tr> 
      <tr> 
     <td colspan="2"><input type="submit" name="submitnewsmsg" id="submitnewsmsg" value="PUBLISH ARTICLE"></td> 
      </tr> 
     </table> 
    </form> 

正如你可以看到我做的值=」,在文本框,但似乎沒有工作,有人可以告訴我如何做到這一點

回答

4

一個textarea的內容textarea的標記中包含類似:

<textarea name="newsmsg" id="newsmsg" cols="80" rows="20" ><?= htmlspecialchars($content); ?></textarea> 
+0

我現在覺得自己很蠢,LOL – ManouHH

+2

我們都有那些捂臉時刻:)。 – Orangepill