2015-01-03 39 views
-4

我想創建一個包含CKEDITOR的html文件,當編輯完成後,html文件會被正確修改。頁面自我編輯

<html> 
<head> 
    <title>Editable</title> 
    // Adds CKEDITOR 
    <script src="//cdn.ckeditor.com/4.4.6/standard/ckeditor.js"></script> 
</head> 

<body> 
    // Simple DIV with in-line CKEDITOR 

    <div id="editable1" contenteditable="true"> 
     <h1>Inline Editing in Action!</h1> 
     <p>The "div" element that contains this text is now editable. 
    </div> 

<script> 

//Adds the editor 
CKEDITOR.disableAutoInline = true; 
CKEDITOR.inline('editable'); 

//When focus is lost, it will perfom the action 
CKEDITOR.instances.editable.on('blur', function(e) 
{ 

    //Right now this change is only client side, i would like to make it serverside 
    $data = CKEDITOR.instances.editable.getData() 
    $id = this.element.$.id 
    document.getElementById('editable').innerHTML = $data 
}); 
</script> 
</body> 
</html> 

如果你看到了,我評論了代碼,所以很好解釋。 我有一個ID,我有一個新的數據,我想修改原來的HTML文件。 我應該使用女巫語言嗎?任何特定的庫?

我想我需要使用PHP

感謝,

回答

0

這是過於寬泛的一個簡單的StackOverflow的答案來回答,但在一個非常簡潔的列表

  1. 步驟瞭解服務器側面語言
  2. 瞭解數據庫
  3. 從HTML頁面提取正文到服務器端頁面
  4. 從數據庫
  5. 使用AJAX或簡單的POST頁打印主體的內容,你可以把身體
  6. 瞭解足夠的JavaScript到正文內容發送到你的新頁面的內容(AJAX或生成的表單)
  7. 當你的新頁面獲取HTML,它保存到數據庫中
  8. 刷新頁面

不要忘記淨化你的投入!

+0

謝謝!我會努力學習更多! <3 –