[英]Create module prestashop 1.5
I created a new module in PrestaShop 1.5 mau file mymodule.php
content 我在PrestaShop 1.5 mau文件
mymodule.php
内容中创建了一个新模块
<?php
if (!defined('_PS_VERSION_'))
exit;
class myModule extends Module
{
public function __construct()
{
$this->name = 'mymodule';
$this->tab = 'Test';
$this->version = 1.0;
$this->author = 'Firstname Lastname';
$this->need_instance = 0;
parent::__construct();
$this->displayName = $this->l('My module');
$this->description = $this->l('Description of my module.');
}
public function install()
{
if (parent::install() == false)
return false;
return true;
}
public function uninstall()
{
if (!parent::uninstall())
parent::uninstall();
}
}
?>
But i have an error msg 但我有一个错误消息
mymodule (erreur de syntaxe dans /modules/mymodule/mymodule.php) mymodule (classe manquante dans /modules/mymodule/mymodule.php)
mymodule(erreur de syntaxe dans /modules/mymodule/mymodule.php)mymodule(classe manquante dans /modules/mymodule/mymodule.php)
can you help me please 你能帮我吗
当我更改页面的编码(在没有BOM的UTF-8中编码)时,这个问题就解决了。
do you create a config.xml file for that module ?? 你为该模块创建一个config.xml文件? and one another thing ... there is not " Test " tab in prestashop .
另一件事...... prestashop中没有“测试”选项卡。 change that to a valid tab attribute .
将其更改为有效的选项卡属性。 http://doc.prestashop.com/display/PS15/Creating+a+PrestaShop+module this link can help you .
http://doc.prestashop.com/display/PS15/Creating+a+PrestaShop+module此链接可以帮助您。
This error often appears when there is just a syntax error in your class file. 当您的类文件中只有语法错误时,通常会出现此错误。 Prestashop can not load the class file, and so, cannot load the module
Prestashop无法加载类文件,因此无法加载模块
You can try to launch a php -l mymodule.php
in command line to detect possible syntax error in the php file 您可以尝试在命令行中启动
php -l mymodule.php
以检测php文件中可能的语法错误
I would choose class name to be same as module name. 我会选择类名与模块名相同。
class mymodule(){
not myModule 不是myModule
Also you've written 你也写过
if (!parent::uninstall())
parent::uninstall();
in meaning if uninstall have errors you unninstall by force? 在意思是如果卸载有错误你强行卸载? I think, it's better to
我想,最好是
if(parent::uninstall())
return false;
return true;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.