我尝试了以下自定义块的代码。当我从管理员添加内容时,它工作正常。但是,仅针对特殊字符发出。
admin\view\template\extension\module\theme_module.twig
<div class="tab-content">
{% for language in languages %}
<div id="tab8-language-{{ language.language_id }}" class="tab-pane">
<div class="form-group">
<div class="col-sm-10">
<textarea name="custom_block[{{ language.language_id }}][description]" data-toggle="summernote" data-lang="{{ summernote }}" class="form-control" id="input-description8{{ language.language_id }}">{{ custom_block[language.language_id].description ? custom_block[language.language_id].description }}</textarea>
</div>
</div>
</div>
{% endfor %}
</div>
管理员\控制器\扩展\模块\theme_module.php
if (isset($this->request->post['custom_block'])) {
$data['custom_block'] = $this->request->post['custom_block'];
} else {
$data['custom_block'] = $this->config->get('custom_block');
}
目录\控制器\common\header.php
$data['config_language_id'] = $this->config->get('config_language_id');
$data['custom_block'] = $this->config->get('custom_block');
目录\视图\主题\默认\模板\常见\header.twig
{% set lang = config_language_id %}
{% if custom_block[lang]['description'] %}
{{ custom_block[lang]['description'] | convert_encoding('UTF-8', 'HTML-ENTITIES') }}
{% endif %}
当我确实添加来自管理员的内容时:ľščťžýáíé
所以,输出:ľšÄťžýáÃé