创建自定义页面prestashop 1.7

时间:2017-08-29 15:10:41

标签: prestashop prestashop-1.7

我已经尝试了2天来创建自定义页面,但我无法做到。我所做的是在根文件夹中创建一个具有模块名称的文件夹(/ var / www / html / myproject / module / xav),然后创建文件xav.php

<?php

if (!defined('_PS_VERSION_'))
exit;

class xav extends Module
{
/* @var boolean error */
protected $_errors = false;

public function __construct()
{
$this->name = 'xav';
$this->tab = 'front_office_features';
$this->version = '1.0';
$this->author = 'Xav13';
$this->need_instance = 0;

parent::__construct();

$this->displayName = $this->l('xav');
$this->description = $this->l('Custom page Xav');
$this->confirmUninstall = $this->l('Are you sure you want to delete 
this module?');
}

public function install()
{
if (!parent::install())
return false;
return true;
}

public function uninstall()
{
if (!parent::uninstall())
return false;
return true;
}
}

同时创建controller / front / about.php width

<?php
class XavAboutModuleFrontController extends ModuleFrontController
{

/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
    parent::initContent();

    $this->setTemplate('module:xav/views/templates/front/about.tpl');
}
}

和views / templates / front / about.tpl width

test

然后安装模块,并访问路径http://localhost/myproject/module/xav/about,但它不起作用。

0 个答案:

没有答案