组件安装错误:JInstaller :: Install:文件不存在

时间:2013-08-06 07:10:54

标签: php joomla joomla3.0

我只是按照video创建了一个组件。我创建了名为admin.zip的组件。我在joomla 3.0中安装时收到以下警告。

  

警告

     

JInstaller ::安装:文件不存在C:\ wamp \ www \ Content \ tmp \ install_52009de34a2c1 \ site \ language \ en-GB.com_helloworld.ini

     

JInstaller ::安装:文件不存在C:\ wamp \ www \ Content \ tmp \ install_52009de34a2c1 \ admin \ language \ en-GB.com_helloworld.ini

我在组件菜单下获得了helloworld组件。但是当我点击它时它会给我错误。它应该显示我在视频中显示的Hello world。

我的wamppserver版本是2.4并使用joomla 3.0。

我该如何纠正这个问题

The error while clicking on hello world component is like this

我的helloworld.xml文件包含此代码

<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="2.5.0" method="upgrade">

    <name>com_helloworld</name>
    <creationDate>November 2009</creationDate>
    <author>David Thorn</author>
    <authorEmail>info@thornwebdesign.org</authorEmail>
    <authorUrl>http://www.example.org</authorUrl>
    <copyright>Copyright Info</copyright>
    <license>License Info</license>
    <version>1.0.0.1</version>
    <description>Description of the Hello World component ...</description>
    <files folder="site">
            <filename>index.html</filename>
            <filename>helloworld.php</filename>
            <filename>controller.php</filename>
            <folder>css</folder>
            <folder>js</folder>
            <folder>views</folder>
            <folder>models</folder>
            <folder>controllers</folder>
            <folder>helpers</folder>
            <folder>language</folder>
        </files>
        <languages folder="site">
                        <language tag="en-GB">language/en-GB.com_helloworld.ini</language>
                        <language tag="en-GB">language/en-GB.com_helloworld.sys.ini</language>
        </languages>    
    <administration>
            <menu>com_helloworld</menu>
            <files folder="admin">
                <filename>index.html</filename>
                <filename>helloworld.php</filename>
                <filename>controller.php</filename>
                <folder>css</folder>
                <folder>js</folder>
                <folder>views</folder>
                <folder>models</folder>
                <folder>controllers</folder>
                <folder>helpers</folder>
                <folder>language</folder>
            </files>
            <languages folder="admin">
                        <language tag="en-GB">language/en-GB.com_helloworld.ini</language>
                        <language tag="en-GB">language/en-GB.com_helloworld.sys.ini</language>
            </languages>            
    </administration>

 </extension>

在我的helloworld.php中,我有这段代码

<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// import joomla controller library
jimport('joomla.application.component.controller');

// Get an instance of the controller prefixed by HelloWorld
$controller = JController::getInstance('Helloworld');

// Perform the Request task
$input = JFactory::getApplication()->input;
$controller->execute($input->getCmd('task'));

 // Redirect if set by the controller
  $controller->redirect();
  ?>

更新

我在joomla 2.5中成功完成了这项工作,但它在最新版本的joomla中无效。我该怎么做才能让它在joomla 3.0中运行

2 个答案:

答案 0 :(得分:0)

检查您是否已将此代码添加到XML中:

<languages>
        <language tag="en-GB" client="site">language/en-GB/en-GB.com_helloworld.ini</language>
        <language tag="en-GB" client="site">language/en-GB/en-GB.com_helloworldt.sys.ini</language>
</languages>

<administration>
... 
    <languages>
            <language tag="en-GB" client="site">language/en-GB/en-GB.com_helloworld.ini</language>
            <language tag="en-GB" client="site">language/en-GB/en-GB.com_helloworld.sys.ini</language>
    </languages>
...
</administration>

并检查文件是否包含在您的安装ZIP中 - 在右侧文件夹中,例如:

language / en-GB / ...

请注意,您的扩展程序的文件路径可能会有所不同。

答案 1 :(得分:0)

您在xml文件路径中缺少en-GB子文件夹声明。 xml:language / en-GB.com_helloword.sys.ini,它应该是language / en-GB / en-GB.helloworld.sys.ini 和路径:language / en-GB / en-GB.helloworld.sys.ini 当然,相同的模式适用于其他语言文件。

*因为您的编辑和源代码包含,包括带有更正的完整xml代码(文件路径和扩展名结束标记)

`

<?xml version="1.0" encoding="utf-8"?>

<name>com_helloworld</name>
<creationDate>November 2009</creationDate>
<author>David Thorn</author>
<authorEmail>info@thornwebdesign.org</authorEmail>
<authorUrl>http://www.example.org</authorUrl>
<copyright>Copyright Info</copyright>
<license>License Info</license>
<version>1.0.0.1</version>
<description>Description of the Hello World component ...</description>
<files folder="site">
        <filename>index.html</filename>
        <filename>helloworld.php</filename>
        <filename>controller.php</filename>
        <folder>css</folder>
        <folder>js</folder>
        <folder>views</folder>
        <folder>models</folder>
        <folder>controllers</folder>
        <folder>helpers</folder>
        <folder>language</folder>
    </files>
    <languages folder="site">
                    <language tag="en-GB">language/en-GB/en-GB.com_helloworld.ini</language>
                    <language tag="en-GB">language/en-GB/en-GB.com_helloworld.sys.ini</language>
    </languages>    
<administration>
        <menu>com_helloworld</menu>
        <files folder="admin">
            <filename>index.html</filename>
            <filename>helloworld.php</filename>
            <filename>controller.php</filename>
            <folder>css</folder>
            <folder>js</folder>
            <folder>views</folder>
            <folder>models</folder>
            <folder>controllers</folder>
            <folder>helpers</folder>
            <folder>language</folder>
        </files>
        <languages folder="admin">
                    <language tag="en-GB">language/en-GB/en-GB.com_helloworld.ini</language>
                    <language tag="en-GB">language/en-GB/en-GB.com_helloworld.sys.ini</language>
        </languages>            
</administration>

` (不能包括扩展开关标签,由于某种原因它不会被打印,请确保正确包含它们)

对于您的另一个问题,在您的helloworld.php中,您可能需要导入joomla控制器库:

jimport('joomla.application.component.controller');

之后

defined('_JEXEC') or die('Restricted access');

并替换它:

$controller = JController::getInstance('Helloworld');

这一个:

$controller = JControllerLegacy::getInstance('Helloworld');