Arteinfo Posted April 20, 2017 Share Posted April 20, 2017 (edited) I am trying to publish a payment form on PrestaShop Addons. But I get the automatic message:"The use of smarty templates is mandatory to display HTML. Your PHP code should not contain HTML." Online validation (https://validator.prestashop.com) does not detect any problems, maybe it's the code (/controllers/front/validation.php): if (!$authorized) die($this->module->l('This payment method is not available.', 'validation')); Edited April 20, 2017 by Arteinfo (see edit history) Link to comment Share on other sites More sharing options...
joseantgv Posted April 20, 2017 Share Posted April 20, 2017 I am trying to publish a payment form on PrestaShop Addons. But I get the automatic message: "The use of smarty templates is mandatory to display HTML. Your PHP code should not contain HTML." carta-docenti.jpg Online validation (https://validator.prestashop.com) does not detect any problems, maybe it's the code (/controllers/front/validation.php): if (!$authorized) die($this->module->l('This payment method is not available.', 'validation')); It's not this code. Link to comment Share on other sites More sharing options...
Arteinfo Posted April 24, 2017 Author Share Posted April 24, 2017 Fixed, the problem was in renderForm(). Link to comment Share on other sites More sharing options...
alexandrieb Posted August 2, 2017 Share Posted August 2, 2017 Hello, I have the same problem. Can you tell me if this was due to a similar code? array( 'type' => 'html', 'label' => $this->l('Maximum size'), 'name' => 'SIZE', 'required' => true, 'html_content' => '<input type="number" class="fixed-width-xl" min="10" max="90" onchange="changeSize();" id="SIZE" name="SIZE" value="'.Tools::getValue('SIZE', Configuration::get('SIZE')).'">' ), Link to comment Share on other sites More sharing options...
Nocebo Posted November 3, 2017 Share Posted November 3, 2017 I have same problem The use of smarty templates is mandatory to display HTML. Your PHP code should not contain HTML Please help me Link to comment Share on other sites More sharing options...
Andrei Dinca Posted May 1, 2018 Share Posted May 1, 2018 Hi, I have the same problem, so I created this simple script for testing purpose. You should put this script into your_prestashop_install/modules/ and change the $rootPath = './azon'; with your module folder path. Thanks, Andrei D. <?php function scanDirRecursive($directory, $regex=null, $get="file", $useFullPath=false, &$dirs=[], &$files=[]) { $iterator = new DirectoryIterator ($directory); foreach($iterator as $info) { $fileDirName = $info->getFilename(); if ($info->isFile () && !preg_match("#^\..*?#", $fileDirName)) { if($get == 'file' || $get == 'both'){ if($regex) { if(preg_match($regex, $fileDirName)) { if ($useFullPath) { $files[] = $directory . DIRECTORY_SEPARATOR . $fileDirName; } else { $files[] = $fileDirName; } } }else{ if($useFullPath){ $files[] = $directory . DIRECTORY_SEPARATOR . $fileDirName; }else{ $files[] = $fileDirName; } } } }else if ($info->isDir() && !$info->isDot()) { $fullPathName = $directory . DIRECTORY_SEPARATOR . $fileDirName; if($get == 'dir' || $get == 'both') { $dirs[] = ($useFullPath) ? $fullPathName : $fileDirName; } scanDirRecursive($fullPathName, $regex, $get, $useFullPath, $dirs, $files); } } if($get == 'dir') { return $dirs; }else if($get == 'file'){ return $files; } return ['dirs' => $dirs, 'files' => $files]; } $rootPath = './azon'; $regex = "#(\.php$)#"; $php_files = scanDirRecursive($rootPath, $regex, 'file', true); $html_tags = array( "a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","math","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rb","rp","rt","rtc","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr" ); foreach( $php_files as $file ){ $file_content = file_get_contents( $file ); if( trim($file_content) != "" ){ echo "<h2>" . ( $file ) . "</h2>"; foreach( $html_tags as $html_tag ){ $pos = strpos( $file_content, "<" . $html_tag ); if( $pos != false ){ var_dump( "<pre>", htmlspecialchars( substr($file_content, $pos, ( strpos($file_content, PHP_EOL, $pos) ) - $pos) ) , "</pre>" ) ; } } } } 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