Add WYSIWYG editor to Prestashop 1.6.X module smarty template form -
i doing custom module in prestashop 1.6.x. in module have form made in smarty. want add wysiwyg editor in smarty form. can tell me how add wysiwyg editor smarty template form? or suggestion appreciable. thanks
you have many solution indicate if element in form have wysiwyg editor. if use helperform can use solution :
solution backoffice / use helper form
$fields_form[0]['form'] = array (             'input' => array (                 array (                     'type' => 'textarea',                     'label' => $this->l ( 'your field:' ),                     'name' => 'pdf_content',                     'autoload_rte' => true,                     'required' => true,                     'lang' => true,                     'rows' => 10,                     'cols' => 100,                     'hint' => $this->l ( 'invalid characters:' ).' <>;=#{}'                 ), **** $helper = new helperform (); **** $helper->generateform ( $fields_form ) second solution in template :
example in yourmodule.php function getcontent
public function getcontent()     {  $iso = $this->context->language->iso_code;                                 $this->tpl_vars['iso'] = file_exists(_ps_core_dir_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en';                                 $this->tpl_vars['path_css'] = _theme_css_dir_;                                 $this->tpl_vars['ad'] = __ps_base_uri__.basename(_ps_admin_dir_);                                 $this->tpl_vars['tinymce'] = true;                                  $this->context->controller->addjs(_ps_js_dir_.'tiny_mce/tiny_mce.js');                                 $this->context->controller->addjs(_ps_js_dir_.'admin/tinymce.inc.js'); in smarty template file :
<script type="text/javascript">     var iso = '{$iso|escape:'quotes':'utf-8'}';     var pathcss = '{$smarty.const._theme_css_dir_|escape:'quotes':'utf-8'}';     var ad = '{$ad|escape:'quotes':'utf-8'}';     $(document).ready(function(){               tinysetup({                 editor_selector :"autoload_rte",                 relative_urls : false,                 plugins : "colorpicker link image paste pagebreak table contextmenu filemanager table code media autoresize textcolor fullpage",                 extended_valid_elements : "em[class|name|id],html,head"             });       }); </script>  <textarea name="content_html" class="rte autoload_rte rte autoload_rte">your text rich</textarea> 
My favorite template editor is Codelobster
ReplyDelete