Jump to content

Creating custom pages on 1.7


The50

Recommended Posts

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 by The50 (see edit history)
Link to comment
Share on other sites

  • 3 months later...

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

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...