Add TinyMCE to a Symfony project
TinyMCE is a inline Wysiwyg HTML editor that is very well integrated with Symfony. Still, you need to download third party sources if you want to use it. This article help you through this process.
Note : This article need you to install the unzip tool. For Debian and Ubuntu, you can install it with apt-get :
/usr/bin/sudo /usr/bin/apt-get install unzip
Installing TinyMCE
First, configure the emplacement of the root of you Symfony project :
PROJECT_HOME=/home/sfprojects/myProject
Choose also the application you want to use TinyMCE with :
PROJECT_APP=frontend
Configure the TinyMCE version you want to use :
TINYMCE_VERSION=3.0.5
We remove the dots from the TinyMCE version :
TINYMCE_CLEANED_VERSION=`echo $TINYMCE_VERSION | sed -e 's/\./_/g'`
We download TinyMCE sources :
/usr/bin/wget http://ovh.dl.sourceforge.net/sourceforge/tinymce/tinymce_$TINYMCE_CLEANED_VERSION.zip \
--output-document=/tmp/tinymce_$TINYMCE_VERSION.zip
We unzip the downloaded file :
/usr/bin/unzip -o /tmp/tinymce_$TINYMCE_VERSION.zip -d /tmp
If you want, you can also download translations for TinyMCE :
/usr/bin/wget http://services.moxiecode.com/i18n/download.aspx?format=zip\&product=tinymce \
--output-document=/tmp/tinymce_language_pack.zip
Unzip the downloaded file in the target directory :
/usr/bin/unzip -o /tmp/tinymce_language_pack.zip -d /tmp/jscripts/tiny_mce
And move the TinyMCE source folder to the target emplacement in your Symfony project :
/bin/cp -r /tmp/jscripts/tiny_mce/ "$PROJECT_HOME/web/js/"
Now, configure your Symfony project to use TinyMCE :
/bin/sed -i -e '/^ .settings:/a\
rich_text_js_dir: js/tiny_mce' "$PROJECT_HOME/apps/$PROJECT_APP/config/settings.yml"
Warning: Check your settings.yml file to make sure that everything want well :
/usr/bin/vim "$PROJECT_HOME/apps/$PROJECT_APP/config/settings.yml"
You can now remove the downloaded files :
/bin/rm -r /tmp/tinymce
/bin/rm /tmp/tinymce_language_pack.zip
/bin/rm /tmp/tinymce_$TINYMCE_VERSION.zip
You can now use TinyMCE with PHP codes like :
<?php echo textarea_tag('name', 'default content', 'rich=true size=10x20') ?>
<?php echo textarea_tag('name', 'default content', array(
'rich' => true,
'size' => '10x20',
'tinymce_options' => 'language:"fr",theme_advanced_buttons2:"separator"',
)) ?>
Thanks
Ridiculously easy...
I've blindly followed your steps and it worked like a charm.
Thank you so much!!
In Thanks section...
admin genarator - formatting not getting saved
TinyMCE in ajax form
http://howto.landure.fr/symfony/trucs-et-astuces-symfony
You can try to translate it using google,or search the web for tinymce, symfony and ajax.
It might be simpler
It might be simpler to use the debian package "tinymce" mit "apt-get install tinymce".
Mybe its not the newest, but it still works!
problem
result like this
" <p>dasar- dasar drupal</p> <p>hal - hal yang harus diperhatikan</p> "
but i not want html script view
do u have solution??
Very useful...