在模块安装时自动在图像下创建新文件夹
Joomla 扩展是否可以在图像下自动创建文件夹(事件)-> /images/events/ 当用户在 Joomla Administrator 中安装扩展时?
Is it possible for a Joomla extension to automatically create a folder (event) under images -> /images/events/ when the user installs the extension inside Joomla Administrator ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在组件的 xml 文件中,您需要添加以下属性:
替换为组件的名称,可以将其添加到组件安装 xml 文件的描述属性下方。
添加后,您将需要创建一个名为“install.componentname.php”的文件,再次将组件名称替换为您的组件名称。
在此文件中添加以下内容:
将其打包并安装,install..php 文件应位于 zip 存档的顶层。最后,您需要将此文件添加到组件文件列表中,在属性后面添加以下行:
如果文件夹创建成功,则会显示文件夹创建成功。
Inside your component's xml file you will need to add in the following attribute:
replace with the name of your component, this can be added just underneath the description attribute of your components install xml file.
Once this has been added you will need to create a file called "install.componentname.php", again replace componentname with the name of your component.
Inside this file add the following:
Package this up and install, the install..php file should be at the top level of your zip archive. Lastly you will need to add this file to your components file list, just after the attribute add the following line:
If the folder is created successfully, it will say Folder created successfully.
您可以在扩展的清单文件中指定要在扩展安装时运行的自定义 php 脚本 [1, 2]。该脚本可以创建您的文件夹
/images/events/
。joomla 1.5 和 1.6 之间的安装程序存在一些差异:
1.5
部分清单文件1.6
清单文件的部分[...] 我看到另一个答案已发布。看看1.5;对于 1.6,请使用
> ;
并查看http://docs.joomla.org/Developers ,尤其是 http://docs.joomla.org/How_to_use_the_filesystem_package 。文件夹的实际创建留给读者作为练习。you can specify a custom php script to be run at extension installation in your extension's manifest file [1, 2]. this script could create your folder
/images/events/
.there are some differences in the installer between joomla 1.5 and 1.6:
1.5
<installfile/>
section of the manifest file1.6
<scriptfile/>
section of the manifest file[...] i see another answer has been posted. have a look at it for 1.5; for 1.6, use
<scriptfile/>
and have a look at http://docs.joomla.org/Developers , especially http://docs.joomla.org/How_to_use_the_filesystem_package . the actual creation of the folder is left as an exercise for the reader.http://docs.joomla.org/Components:xml_installfile
http://docs.joomla.org/Components:xml_installfile