Prestashop, How to Create a New Non-CMS Page For JS,CSS, PHP -
prestashop v1.6
hi,
i need create new non-cms form page includes logic, js, css, , maybe php.
this page submit php script perform logic , redirect page.
if possible include php in form page, if not, need include php in formpagecontroller , use template file or something.
apart body, include form, page needs shop need include header , footer.
i tried using cms page restrictive in allow.
i set root file: form-page.php
<?php include(dirname(__file__).'/config/config.inc.php'); tools::displayfileasdeprecated(); include(dirname(__file__).'/header.php'); $smarty->display(_ps_theme_dir_.'form-page.tpl'); include(dirname(__file__).'/footer.php');
a controller: formpage.php
<?php class formpagecontrollercore extends frontcontroller { public function init(){ parent::init(); } public function setmedia() { parent::setmedia(); $this->addcss(_theme_css_dir_.'form-page.css'); $this->addjs(_theme_js_dir_.'form-page.js'); $this->addjs(_ps_js_dir_.'validate.js'); } public function initcontent() { parent::initcontent(); } } ?>
a template file: form-page.tpl
<div> <!-- html --> </div> {literal} <style type="text/css"> </style> {/literal} <script type="text/javascript"> {literal} {/literal} </script>
and linked page in admin->preferences->seo pages
as result getting totally black pages.
to complete task, there other files have add?
what minimum skeleton each of required files make work?
where else may going wrong?
thanks
1) create php file in ps root: formpage.php (for example)
include(dirname(__file__).'/config/config.inc.php'); tools::displayfileasdeprecated(); include(dirname(__file__).'/header.php'); $smarty->display(_ps_theme_dir_.'formpage.tpl'); include(dirname(__file__).'/footer.php');
2) create new controller: root/controllers/front/formpagecontroller.php
class formpagecontroller extends frontcontroller{ public function init(){ parent::init(); } public function setmedia() { parent::setmedia(); $this->addjs(_theme_js_dir_.'formpage.js'); } public function initcontent(){ parent::initcontent(); $this->settemplate(_ps_theme_dir_.'formpage.tpl'); } }
3) create new .tpl file in theme folder content
so in example think controller file name bad?
after delete cache-> class_index.php file
Comments
Post a Comment