The50 Posted December 1, 2016 Share Posted December 1, 2016 (edited) Hello, I need some help with creating a custom page. I follow some of the tutorials found in this forum, but I guess something has changed since 1.7 came out. My controller NewPageController.php: <?php class NewPageControllerCore extends FrontController { public $php_self = 'new-page.php'; public function setMedia() { parent::setMedia(); } public function displayContent() { parent::displayContent(); self::$smarty->display(_PS_THEME_DIR_.'templates/new-page.tpl'); } } I access my site using following URL: http://localhost/prestashop_testing/en/index.php?controller=new-page Page name "new-page" is registered in SEO and URLs settings. Now I get the SmartyException, it says that the template name is missing. I see that self::$smarty->display() is deprecated already. Any ideas how can I call my template? EDIT: Found that other controllers now use initContent() function, everything works fine now. Now one more question, is it possible to have clean URLs? At the moment I access my page only via index.php?controller=new-page. Is it possible to make it /new-page only? Edited December 1, 2016 by The50 (see edit history) Link to comment Share on other sites More sharing options...
ventura Posted December 1, 2016 Share Posted December 1, 2016 Now one more question, is it possible to have clean URLs? At the moment I access my page only via index.php?controller=new-page. Is it possible to make it /new-page only? Activate rewrite-urls in Preferences / SEO & urls 1 Link to comment Share on other sites More sharing options...
luzamartinez Posted March 31, 2017 Share Posted March 31, 2017 Hello, I need some help with creating a custom page. I follow some of the tutorials found in this forum, but I guess something has changed since 1.7 came out. My controller NewPageController.php: <?php class NewPageControllerCore extends FrontController { public $php_self = 'new-page.php'; public function setMedia() { parent::setMedia(); } public function displayContent() { parent::displayContent(); self::$smarty->display(_PS_THEME_DIR_.'templates/new-page.tpl'); } } I access my site using following URL: http://localhost/prestashop_testing/en/index.php?controller=new-page Page name "new-page" is registered in SEO and URLs settings. Now I get the SmartyException, it says that the template name is missing. I see that self::$smarty->display() is deprecated already. Any ideas how can I call my template? EDIT: Found that other controllers now use initContent() function, everything works fine now. Now one more question, is it possible to have clean URLs? At the moment I access my page only via index.php?controller=new-page. Is it possible to make it /new-page only? Please! Can you explain how to add custom pages? I've tried and I can not get it to show. 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