symfony - how can i use Tinymce in twig (symfony2) -


i want use tinymce in symfony project befor define editor can read form , write database after define tinymce , set selector textarea in above of twig file

{# src/my/filmbundle/resources/views/page/newfilm.html.twig #} {% extends 'myfilmbundle::layout.html.twig' %} {% block javascripts %}     <script type="text/javascript" src="{{asset('tinymce/jscripts/tiny_mce/tiny_mce.js')}}"></script>     <script type="text/javascript">         tinymce.init({             selector: "textarea"         });     </script>  {% endblock %}  {% block body %}      <form action="{{ path('myfilmbundle_submitnewfilm') }}" method="post" {{ form_enctype(form) }} class="movie">         {{ form_errors(form) }}           {{ form_row(form.text)}}          {{ form_rest(form) }}          <input type="submit" value="{{ 'submit'}}" />     </form> {% endblock %} 

and add code buildfilmform (php class) cannot able read form

   class buildfilmform extends abstracttype     {         public function buildform(formbuilderinterface $builder, array $options)         {           $builder->add('text', 'textarea')         }          public function getname()         { // return unique identifier             return 'my_filmbundle_buildfilmform';         } } 

the action reading form , save db:

public function submitnewfilmaction() {     $em = $this->getdoctrine()->getentitymanager();      $newfilm = new film();      $user = $this->getuser();     $user_obj = $em->getrepository('myfilmbundle:author')->find($user);      $newfilm->setauthor($user);      $form = $this->createform(new buildfilmform(), $newfilm);     $form->bind($this->getrequest());      if ($form->isvalid()) {         $film = $form->getdata();          $em->persist($film);         $em->flush();          return $this->redirect($this->generateurl('myfilmbundle_homepage'));     }       return $this->render(         'myfilmbundle:page:newfilm.html.twig', array(         'form' => $form->createview(),      )); } 

i dont know how can able use

// html contents of active editor console.debug(tinymce.activeeditor.getcontent());  // raw contents of active editor tinymce.activeeditor.getcontent({format : 'raw'});  // content of specific editor: tinymce.get('content id').getcontent() 

that said in tinymce site

can me?

thanks lot

p.s : added tinymce-dev project , want know how can able use above code in project

:d work :p change textarea in buildform

$builder->add('text', 'textarea') 

to :

$builder->add('text', 'textarea', array('required'=>false)); 

this link explain :)

can't submit form symfony2 , tinymce


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -