This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Rich textarea and saving html in db

Discussion specific to symfony 1.1.x stable

Rich textarea and saving html in db

by kindrosker » Sat Jul 19, 2008 4:39 pm

hi

http://www.symfony-project.org/book/1_1/10-Forms
we know how to use some text editors but (and I'm using fck) but I can't save html in db
Code: Select all
<p><strong><p><p><p><strong>asdasdasdads</strong></p></p></p></strong></p>


how to set off htmlspecialchars for one description field for example?
User avatar
kindrosker
Member
 
Posts: 59
Joined: Sat Jul 12, 2008 12:16 am
Location: Ukraine

Re: Rich textarea and saving html in db

by kindrosker » Sat Jul 19, 2008 4:50 pm

Found it. Sorry it's my fault.

I created new widget for fck editor (we can't use fck using sfWidgetFormTextarea.class.php because it's using renderTag and just create string with html tags )
Code: Select all
return sprintf('<%s%s%s', $tag, $this->attributesToHtml($attributes), self::$xhtml ? ' />' : sprintf('></%s>', $tag));


but if we want use fck we need to use textarea_tag where we have next:
Code: Select all
    switch ($rich)
    {
      case 'tinymce':
        $rich = 'TinyMCE';
        break;
      case 'fck':
        $rich = 'FCK';
        break;
    }


So I created new widget for fck.
User avatar
kindrosker
Member
 
Posts: 59
Joined: Sat Jul 12, 2008 12:16 am
Location: Ukraine

Re: Rich textarea and saving html in db

by jcodybaker » Wed Jul 30, 2008 6:01 pm

Any chance you'd mind sharing your rich-text widget?
jcodybaker
Junior Member
 
Posts: 2
Joined: Wed Jul 30, 2008 5:57 pm
Location: Ohio, USA

Re: Rich textarea and saving html in db

by jcodybaker » Wed Jul 30, 2008 7:21 pm

Ok, so i just broke down and wrote my own. It's quick and hopefully not TOO dirty.
Attachments
sfWidgetFormRichTextEditorFCK.class.php
(3.34 KiB) Downloaded 369 times
jcodybaker
Junior Member
 
Posts: 2
Joined: Wed Jul 30, 2008 5:57 pm
Location: Ohio, USA

Re: Rich textarea and saving html in db

by kindrosker » Wed Jul 30, 2008 11:12 pm

Hi
you can create widget using textarea tag, for example
Code: Select all
return textarea_tag($name, $value,array('rows'=>30,'cols'=>70, 'tool'=>'Custom', 'rich'=>'fck'));


see attached
Attachments
sfWidgetFormTextareaFck.class.php
(959 Bytes) Downloaded 313 times
User avatar
kindrosker
Member
 
Posts: 59
Joined: Sat Jul 12, 2008 12:16 am
Location: Ukraine

Re: Rich textarea and saving html in db

by slac » Thu Oct 21, 2010 4:37 pm

Is this supossed to work in Symfony 1.4?
If not, what is the best way to have a rich text area in symfony 1.4?
slac
Junior Member
 
Posts: 3
Joined: Thu Oct 14, 2010 4:39 pm

Re: Rich textarea and saving html in db

by kindrosker » Thu Oct 21, 2010 4:42 pm

slac wrote:Is this supossed to work in Symfony 1.4?
If not, what is the best way to have a rich text area in symfony 1.4?


this should work, there is nothing special there but I did not test it
might need to recreate widget (just see like there widget creates in symfony 1.4)
again it's really simple

as for me fck is the best
User avatar
kindrosker
Member
 
Posts: 59
Joined: Sat Jul 12, 2008 12:16 am
Location: Ukraine

Re: Rich textarea and saving html in db

by defaka » Thu Oct 21, 2010 4:58 pm

Is this supossed to work in Symfony 1.4?
If not, what is the best way to have a rich text area in symfony 1.4?

symfony FormHelper is removed in symfony 1.4. You have to use widget, except you are using symfony 1.3 or below
defaka
Senior Member
 
Posts: 148
Joined: Mon Feb 19, 2007 5:56 am