无需CMS的Prestashop 1.6中的自定义页面 [英] Custom page in Prestashop 1.6 without CMS

查看:345
本文介绍了无需CMS的Prestashop 1.6中的自定义页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在根据Bootstrap创建自定义页面,因此无法通过CMS。

I'm currently creating a customized page based on Bootstrap so I cannot pass through the CMS.

我创建了一个文件 Mypage.php 我在Prestahop根包含此代码:

I created a file Mypage.php that I put at the Prestahop root containing this code :

<?php
    require(dirname(__FILE__).'/config/config.inc.php');
    ControllerFactory::getController('MypageController')->run();
?>



<在override / controllers / front中包含此代码:

Then I created a controller MypageController.php containing this code in override/controllers/front :

class MypageControllerCore extends FrontController
{
    public $php_self = 'Mypage.php';
    public $ssl = true;

    public function preProcess()
    {
        parent::preProcess();
    }

    public function setMedia()
    {
        parent::setMedia();
        Tools::addCSS(_THEME_CSS_DIR_.'Mypage.css');
    }

    public function displayContent()
    {
        $_POST = array_merge($_POST, $_GET);
        parent::displayContent();
        self::$smarty->display(_PS_THEME_DIR_.'Mypage.tpl');
    }
}

我自然会删除 cache / class_index.php

I naturally erased cache/class_index.php but I still get a 404 error. Any ideas?

推荐答案


  • 移动 MypageController.php root / controllers / front

  • 更改 public $ php_self ='mypage';

  • 转到 BO>偏好设定> SEO& URL 并添加新页面,请为页面字段选择 mypage

    • Move MypageController.php to root/controllers/front .
    • Change public $php_self = 'mypage';.
    • Go to BO > Preferences > SEO & URLs and add a new page, select mypage for the Page field.
    • 您的根目录中不需要 Mypage.php ,您可以在链接 yoururl / index访问您的控制器。 php?controller = mypage 。但是如果你想使用它,写 Controller :: getController('MypageController') - > run();

      There is no need for the Mypage.php in your root, you can access your controller at link yoururl/index.php?controller=mypage. But if you want to use it, write Controller::getController('MypageController')->run();.

      这篇关于无需CMS的Prestashop 1.6中的自定义页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆