由于我不理解 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 的标记类。希望这不是一个愚蠢的问题。
最佳答案
关于php - 我的部分模板或 html 消失了。为 Prestashop 1.7.6.1、php 7.1.9 创建模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58191907/