pandamasta

Untitled

Dec 29th, 2013
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. Controller (application/classes/Controller/Editor.php)
  2. ------------------------------------------------------
  3.  
  4. <?php
  5. class Controller_Editor extends Controller_Template
  6. {
  7. public $template = 'editor';
  8.  
  9. function before()
  10. {
  11. parent::before();
  12. $this->template->editor = '';
  13. }
  14. function after()
  15. {
  16.  
  17. parent::after();
  18. }
  19. public function action_index() {
  20.  
  21. $this->template->editor = Ckeditor::instance();
  22. }
  23. public function action_text() {
  24.  
  25. $this->template->result = $_POST[ 'name' ];
  26. }
  27.  
  28.  
  29. }
  30.  
  31.  
  32. View application/views/editor.php
  33. -----------------------------------
  34.  
  35.  
  36. <!DOCTYPE html>
  37. <html>
  38. <head>
  39. <title>Cool site</title>
  40. </head>
  41. <body>
  42.  
  43.  
  44. <form method="post" action="<?php echo URL::site('editor/text') ?>" >
  45.  
  46. <?php
  47. echo $editor->editor('name', 'Lorem ipsum...', array('width' => 400));
  48. ?>
  49.  
  50. <input type="submit" />
  51. </form>
  52. </body>
  53. </html>
  54.  
  55.  
  56. application/views/text.php
  57. -------------------------------
  58.  
  59. <?php echo "blabla" ?>
  60.  
  61.  
  62.  
  63.  
  64. Error when I submoit on editor/text
  65. -------------------------------------
  66.  
  67. ErrorException [ Fatal Error ]: Call to a member function editor() on a non-object
  68.  
  69. APPPATH/views/editor.php [ 12 ]
  70.  
  71. 7
  72. 8
  73. 9 <form method="post" action="<?php echo URL::site('editor/text') ?>" >
  74. 10
  75. 11 <?php
  76. 12 echo $editor->editor('name', 'Lorem ipsum...', array('width' => 400));
  77. 13 ?>
  78. 14
  79. 15 <input type="submit" />
  80. 16 </form>
  81. 17 </body>
  82.  
  83. {PHP internal call} » Kohana_Core::shutdown_handler()
Advertisement
Add Comment
Please, Sign In to add comment