php - 我的部分模板或 html 消失了。为 Prestashop 1.7.6.1、php 7.1.9 创建模块

标签 php css templates smarty prestashop-1.7

由于我不理解 home.tpl 文件中的一个 div 标签和一个类从我的代码中消失的原因。该模块称为 upload_data,它按如下方式组织在文件夹中: image that shows the arrangement of folders

这是我的代码

上传数据.php

<?php
class Upload_data extends Module
{
    public function __construct()
    {
        $this->name = 'upload_data';
        $this->author = 'Luis Sorto';
        $this->version = '1.0.0';
        $this->bootstrap = true;
        parent::__construct();
        $this->displayName=$this->l('Upload CSV Files');
        $this->description=$this->l('This is a test module to upload csv files');
        $this->ps_versions_compliancy = array('min' => '1.7.0.0', 'max' => '1.7.99.99');
    }
    public function install()
    {
        return parent::install() && $this->registerHook('displayHome');
    }
    public function uninstall()
    {
        return parent::uninstall();
    }
    public function hookDisplayHome()
    {
        return $this->display(__FILE__, 'views/templates/hook/home.tpl');
    }
    public function hookHeader()
    {
        $this->context->controller->addCSS(array(
            $this->_path.'views/css/upload_data.css'
        ));
        $this->context->controller->addJS(array(
            $this->_path.'views/js/upload_data.js'
        ));
    }
    public function getContent()
    {
        return $this->display(__FILE__, 'views/templates/admin/configure.tpl');
    }
}
?>

首页.tpl

<div class="row">
    <div class="col-lg-12">
        <img src="http://via.placeholder.com/1920x350" class="upload_data-img"/>
    </div>
</div>

上传数据.css

.upload_data-img{width:100%;}

当我使用 xampp 在我的本地主机中加载页面时,这是我在检查代码时得到的结果

<div class="row">
    <img src="http://via.placeholder.com/1920x350">
</div>

我尝试使用 google chrome 工具编辑 html,如果我添加 div 和类,它会完美运行。显然,当我刷新页面时,此更改不会出现。

我试过更改 css 文件的位置并将其复制到任何地方,但它对我不起作用。还尝试更改 className 的标记类。希望这不是一个愚蠢的问题。

最佳答案

Prestashop 有一个内置的移动设备检测器,您可以在模块设置中隐藏一些移动模块,这样您就可以检查它(因为打开了开发工具的 Chrome 我认为是移动设备)。

enter image description here

关于php - 我的部分模板或 html 消失了。为 Prestashop 1.7.6.1、php 7.1.9 创建模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58191907/

相关文章:

javascript - 快照网站上的所有 CSS

css - 如何关闭 Bootstrap 雪人模板中的完全响应功能?

模板类中模板函数的 C++ 特化

php - 如何启动一个新的大型 ZF2 项目?

php - 脚本在实时服务器上运行良好但在 wamp 上运行不正常

php - foreach 中的 while 循环导致空白页

php - 通过在 PHP 中添加时间来获取 SUM

php - 如何在 Wordpress 中设置类别标题的样式?

css - 使跨度不包裹在固定宽度的其他div中

c++ - 编译器对模板的无效实例化给出错误