Joomla plugin install xml — install file to differ

2019-08-10 22:33发布

问题:

Is it possible to install a file from a Joomla plugin to a non-plugin directory?

For example-- by default a Joomla plugin install xml looks like this:

<?xml version="1.0" encoding="utf-8"?>
<install version="1.5" type="plugin" group="mycomponent" method="upgrade">
<name>MyPlugin</name>
<author>Me Myself</author>
<creationDate>January 29, 2011</creationDate>
<copyright>Copyright (C) 2011 ME</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<authorEmail>me@mysite.com</authorEmail>
<authorUrl>www.mysite.com</authorUrl>
<version>1.5</version>
<description>My cool plugin.</description>
<files>
    <filename plugin="myplugin">myplugin.php</filename>
</files>
<params />
</install>

This will install the myplugin.php file to the /plugins/mycomponent plugins folder.

However, if I want to install some image files to make my plugin look nicer, and want to drop those in the /images folder, is there a way to supply that path?

Thanks

回答1:

<!-- Site Main Media File Copy Section -->
    <media destination="com_helloworld">
        <filename>image.png</filename>
        <filename>flash.swf</filename>
    </media>

http://docs.joomla.org/Components:xml_installfile



回答2:

<files>
    <filename plugin="myplugin">myplugin.php</filename>
    <folder>dummyFolder</folder>
</files>

In this way you can add dummyFolder to plugins=>mycomponent=>dummyfolder