Nocebo Posted November 6, 2017 Share Posted November 6, 2017 Hello everyone, I'm trying to validate a module, but it sends me an error The use of smarty templates is mandatory to display HTML. Your PHP code should not contain HTML. I wrote to the support, they told me : remove the displayed HTML tags : 721: $html = '<script type="text/javascript"> 1053: return '<p class="alert alert-warning">'. $html = '<a class="btn '.$class.'" href="'.AdminController::$currentIndex. '&configure='.$this->name. '&token='.Tools::getAdminTokenLite('AdminModules'). '&changeStatus&id_img=' .(int)$id_img.'" title="'.$title.'"><i class="'.$icon.'"></i> '.$title.'</a>'; I need these elements, I do not know how to modify them to be accepted thank you in advance for your help Link to comment Share on other sites More sharing options...
electriz Posted November 6, 2017 Share Posted November 6, 2017 Hi, That means You have to assign Your php variables to smarty variables and print Your content in ,tpl file which You can hook wherever you need. Link to comment Share on other sites More sharing options...
Nocebo Posted November 6, 2017 Author Share Posted November 6, 2017 (edited) Thank you for your help. Could you give me an example. plz 1053: return '<P class="alert alert-warning">'. protected function getWarningMultishopHtml() { if (Shop::getContext() == Shop::CONTEXT_GROUP || Shop::getContext() == Shop::CONTEXT_ALL) { return '<p class="alert alert-warning">' . $this->getTranslator()->trans( 'You cannot manage image from a "All Shops" or a "Group Shop", select the shop to edit', array(), 'Modules.homeimgpromo.Admin' ) . '</p>'; } else { return ''; } } Edited November 6, 2017 by Nocebo (see edit history) Link to comment Share on other sites More sharing options...
razaro Posted November 6, 2017 Share Posted November 6, 2017 That is all example you need In return you have p element that is HTML in PHP. You could try to replace that included functions $this->displayWarning() or $this->displayError() . If you really need to show HTML maybe use custom function that will call tpl file, usually placed in admin folder, and pass some smarty variable. Same way you would pass to front office tpl file. Link to comment Share on other sites More sharing options...
Nocebo Posted November 6, 2017 Author Share Posted November 6, 2017 Thank for your reply. that's what I did public function hookActionAdminControllerSetMedia() { $this->context->controller->addJs($this->_path.'views/js/admin.js'); } JS : $(function() { var $myimgs = $("#imgs"); $myimgs.sortable({ opacity: 0.6, cursor: "move", update: function() { var order = $(this).sortable("serialize") + "&action=updateimgsPosition"; $.post("'.$this->context->shop->physical_uri.$this->context->shop->virtual_uri. 'modules/ps_Module/ajax_ps_Module.php?secure_key='.$this->secure_key.'", order); } }); $myimgs.hover(function() { $(this).css("cursor","move"); }, function() { $(this).css("cursor","auto"); }); }); But the link is not good Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now