Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Свой php-код в модуле html


Recommended Posts

Добрый гдень.

 

Помогите пжлст с с иким вопросом..

Создал в админке модуль html, ввел заголовок и текст. При ввогде текси, перешел в режим code view и всивил код:

<?php echo 'Test'; ?>

Сохранил модуль, но на страниэто он не выводится. Затем заново открыл модуль в том же окне, а им он сил иким:

<!--?php echo 'Test'; ?-->

Нужно чтобы на страниэто вывелось Test.

 

Opencart Version 2.0.3.1 (trs.2.0.3.0)

Edited by Maga499
Link to comment
Share on other sites


создай другой модуль

 

Я хочу скопировать модуль html, и назвать его например MyPhpModul.

 

В контроллере html есть код:

...
$data['html'] = html_entity_decode($setting['module_description'][$this->config->get('config_language_id')]['description'], ENT_QUOTES, 'UTF-8');
...

Как я понял, $data - это переменная которая выводит согдержимое <textarea>. Нужно чтобы в эту переменную заносился код, без никаких преобразований. Как это сгделать?

Link to comment
Share on other sites


  • 2 years later...

Добрый гдень, 

/www/lepnini.ru/catalog/controller/module/html.php это контроллер модуля Текстовый блок - HTML > Правая колонка карточки товара?

 

 

 

$data['php'] = eval($setting['module_description'][$this->config->get('config_language_id')]['description']);

 

Данную строчку кода сивлю после строчки $data['html'], но модуль продолжает закомменливать php код при добавлении в режиме code view. Версия опенкарт Version 2.1.0.1 (trs-2.1.0.0). Спасипотому что!

<?php
class ControllerModuleHTML extends Controller {
	public function index($setting) {
		if (isset($setting['module_description'][$this->config->get('config_language_id')])) {
			$data['heading_title'] = html_entity_decode($setting['module_description'][$this->config->get('config_language_id')]['title'], ENT_QUOTES, 'UTF-8');
			$data['html'] = html_entity_decode($setting['module_description'][$this->config->get('config_language_id')]['description'], ENT_QUOTES, 'UTF-8');
			


			if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/html.tpl')) {
				return $this->load->view($this->config->get('config_template') . '/template/module/html.tpl', $data);
			} else {
				return $this->load->view('default/template/module/html.tpl', $data);
			}
		}
	}
}
Edited by petyamirniy
Link to comment
Share on other sites


  • 3 weeks later...

У меня не закомменливает, но все равно не выполняет, просто игдет код в html, чтобы редактор не закомменливал, сгделал ик, перешел на редактор CKEditor, в ocstore это есть и добавил в файл config.js строки в конэто

 

	CKEDITOR.config.indentClasses = ["ul-grey", "ul-red", "text-red", "ul-content-red", "circle", "style-none", "decimal", "paragraph-portfolio-top", "ul-portfolio-top", "url-portfolio-top", "text-grey"];
    CKEDITOR.config.protectedSource.push(/<(style)[^>]*>.*<\/style>/ig);// разрешить теги <style>
    CKEDITOR.config.protectedSource.push(/<(script)[^>]*>.*<\/script>/ig);// разрешить теги <script>
    CKEDITOR.config.protectedSource.push(/<\?[\s\S]*?\?>/g);// разрешить php-код
    CKEDITOR.config.protectedSource.push(/<!--dev-->[\s\S]*<!--\/dev-->/g);
    CKEDITOR.config.allowedContent = true; /* все теги */

 

Edited by vman
обшибки
Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share


×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.