I am not able to get TinyMCE editor into my twig file. my twig file code is as below
{% block content %}
{{ tinymce_init() }}
<div class="content">
<h2 class="pg-title">Add emailTemplate</h2>
<div class="specialty adProvier">
<form action="{{ path('_admin_new_emailTemplate') }}" method="post" {{ form_enctype(form) }} class="specialtyForm" id="add-emailTemplate">
{{ form_row(form._token) }}
{{ form_row(form.templateKeyword) }}
{{ form_row(form.senderEmail) }}
{{ form_row(form.translations)}}
{{ form_row(form.isActive) }}
{{ form_rest(form) }}
<div class="buttons">
<input type="submit" id="save" class="button" value="Save" />
<input type="button" id="cancel" class="button" value="Cancel" />
</div>
</form>
</div>
</div>
{% endblock %}
{% block javascripts %}
<script type="text/javascript" src="{{ asset('bundles/dashboardadmin/js/admin.js') }}"></script>
<script type="text/javascript" src="{{ asset('bundles/stfalcontinymce/js/init.jquery.js') }}"></script>
<script type="text/javascript" src="{{ asset('bundles/stfalcontinymce/js/init.standard.js') }}"></script>
<script type="text/javascript" src="{{ asset('bundles/stfalcontinymce/js/ready.min.js') }}"></script>
<script type="text/javascript">
tinymce.init({
selector: 'textarea',
});
</script>
{% endblock %}
My Form builder file has the below code:
$builder->add('content', 'textarea', array(
'attr' => array(
'label' => 'Content:',
'class' => 'tinymce',
'data-theme' => 'simple' // simple, advanced, bbcode
)
));
Now my problem is that im not able to see tinyMce editor for my Content textarea..
im just getting a simple textarea field.
Please help me getting the tinyMCE editor
I suggest you to use the {{ tinymce_init() }}
function in your Twig template (it will save you from using {{ asset() }}
) andconfigure TinyMCE with app/config/config.yml file . With the ".tinymce" selector and the "tinymce" class on your <teaxtarea>
, it should work. The TinyMCE configuration is detailed in its documentation .
I suggest you this simple configuration :
stfalcon_tinymce:
include_jquery: false
tinymce_jquery: true
selector: ".tinymce"
Have you checked that TinyMCE is properly installed in your bundles ? Do you see TinyMCE when running the php app/console assets:install web --symlink
command ? Have you cleared your browser's cache ?
you are following JavaScript use in your twig file
INCLUDE IN THIS SCRIPT http://tinymce.cachefly.net/4.0/tinymce.min.js
<script src="http://tinymce.cachefly.net/4.0/tinymce.min.js"></script>
tinymce.init({
selector: '.absurls',
plugins: 'link image code',
relative_urls: false
});
tinymce.init({
selector: '#abshosturls',
plugins: 'link image code',
relative_urls: false,
remove_script_host: false
});
tinymce.init({
selector: '#relurls',
plugins: 'link image code',
relative_urls: true
});
tinymce.init({
selector: '#relurlstopage',
plugins: 'link image code',
relative_urls: true,
document_base_url: 'http://www.tinymce.com/tryit/'
});
tinymce.init({
selector: "#nourlconvert",
plugins: 'link image code',
convert_urls: false
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.