Jump to content

How to make new page without CMS ?


newbie_presta19

Recommended Posts

Hello ! I'm newbie in prestashop
I want to make new page without cms. Now I have problem, the page can't show only white page. Can some one help me ? 
Thanks 

 

root/overide/classes/controller/FrontController.php

<?php
class FrontController extends FrontControllerCore
{
    public function init() {
        parent::init();
     $this->context->smarty->assign(currentController', get_class($this));
    }
}
?>

root/testpage.php

<?php
require(dirname(__FILE__).'/config/config.inc.php');
Tools::displayFileAsDeprecated();
Tools::redirect('index.php?controller=testpage'.($_REQUEST ? '&'.http_build_query($_REQUEST, '', '&') : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently');
?>

root/themes/default-boostrap/testpage.tpl

{include file="$tpl_dir./breadcrumb.tpl"}
{include file="$tpl_dir./errors.tpl"}
<h1>Testpage</h1>
controller: {$currentController} <!-- Should be : TestpageController -->

root/controllers/front/TestpageController.php

<?php
class TestpageControllerCore extends FrontController
{
public $php_self = 'testpage';

public function initContent()
{
parent::initContent();
$this->setTemplate(_PS_THEME_DIR_.'testpage.tpl');
}
}
?>

SEO/URL - new page -page : testpage title Testpage friendly-url :testpage

Link to comment
Share on other sites

Hi

 

Best way to do this is to create a new module. I recently did this and used this tutorial:

 

http://doc.prestashop.com/display/PS16/Creating+a+PrestaShop+Module

 

This worked really well and also gave me a better understanding of how PS works.

 

There are other tutorials by Nemo which are also very good here:

 

https://www.prestashop.com/forums/topic/194700-free-tutorial-series-prestashop-101/

Link to comment
Share on other sites

Yeah you have more control with module and Nemo's tutorial is great starting point combining with official docs.

 

But other way you tried should work also. You do not need testpage.php in root if you using latest version of Prestashop.

 

Try to clear cahe in Advanced Preferences > Performance in back office and also  if you have white page try to enable debug mode.

 

https://www.prestashop.com/forums/topic/224525-how-to-turn-on-error-reporting-for-debug-information-blank-page-500-internal-server-error/

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
×
×
  • Create New...