简体   繁体   English

使用核心Joomla组件作为自定义组件的基础

[英]Using a core Joomla component as a base for a custom component

I'm attmpting to pull all the necessary files that make up the Weblinks core componnent out of my Joomla 2.5 installation into a separate directory so that I can use it to make a custom component with additional fields. 我正在努力将构成Web链接核心组件的所有必要文件从我的Joomla 2.5安装中拉到一个单独的目录中,以便我可以使用它来创建带有其他字段的自定义组件。

My problems are: 我的问题是:

  1. I can't seem to figure out all the files needed to be pulled out in order to then successfull re-install the custom component 我似乎无法弄清楚需要拔出的所有文件才能成功重新安装自定义组件
  2. I can't seem to figure out all the renaming that needs to be done in the custom component in order to ensure it doesn't corrupt the core installation when I re-install it. 我似乎无法弄清楚需要在自定义组件中完成的所有重命名,以确保在重新安装时不会破坏核心安装。

Has anyone done this before? 有没有人这样做过? I looked at creating a custom component from scratch and it seems like far too much workfor a non web developer. 我考虑从头开始创建一个自定义组件,对于非Web开发人员来说,这似乎太过分了。 This also seems overkill in order to add a couple of fields. 为了添加几个字段,这似乎有些过分。

Make a clean copy (off-root) of the component's folder structure as required by the component's manifest file (the xml in the administrator/components/com_weblinks). 根据组件的清单文件(administrator / components / com_weblinks中的xml)的要求,对组件的文件夹结构进行干净的复制(根目录)。

This should be installable and complete to start with. 这应该是可安装的并且完整开始。

Now issue the following commands if you're on Linux or OSX; 现在,如果您使用的是Linux或OSX,请发出以下命令; or download cygwin if you're on windows 或者如果你在Windows上下载cygwin

grep -rl oldname . |xargs sed -i -e 's/oldname/newname/g'
grep -rl Oldname . |xargs sed -i -e 's/Oldname/Newname/g'
grep -rl OLDNAME . |xargs sed -i -e 's/OLDNAME/NEWNAME/g'
rename 's/oldname/newname/g' *

Make sure you renamed all occurences: 确保重命名所有出现的内容:

grep -rli oldname .

If nothing comes up, you're good to go; 如果什么都没有出现,你很高兴; else, simply grep and pipe to sed as shown above. 否则,只需grep和pipe to sed,如上所示。 Make sure you never use case-insensitive replacements: that would definitely break your code. 确保你永远不会使用不区分大小写的替换:这肯定会破坏你的代码。

Proofread the .xml manifest manually. 手动校对.xml清单。

Repackage, and try installing. 重新包装,并尝试安装。 Read any error messages (or the error log if it's not clear), you should have little to no problems making an installable package). 阅读任何错误消息(或错误日志,如果不清楚),制作可安装程序包时应该几乎没有问题。 Installing repeatedly does not cause damage (unless you make naming mistakes in the .xml files). 重复安装不会造成损坏(除非您在.xml文件中出现命名错误)。

PS: This answers your question, but maybe @David-Frisch's suggestion could be easier and more effective in your case, you get all the component structure set up in a neat and simple style, with little redundancy in the frontend editing features, but overall a great start. PS:这回答了你的问题,但也许@ David-Frisch的建议在你的情况下可以更容易和更有效,你可以以简洁的方式设置所有组件结构,前端编辑功能几乎没有冗余,但总的来说一个美好的开始。 They moved to a new site . 他们搬到了一个新的网站

You can create new component easily by using joomla's Official tutorials . 您可以使用joomla的官方教程轻松创建新组件。

First you have to identify you requirement like your component required Front end and back end or sql tables etc. 首先,您必须确定您的需求,例如所需的组件前端和后端或sql表等。

The next step is to identify you requirement matching Joomla official tutorials That you can easily get from Articles in this series section. 下一步是确定您的要求与Joomla官方教程相匹配您可以从本系列文章中的文章中轻松获得。

At the end of that tutorial you can download a com_helloworld component. 在该教程结束时,您可以下载com_helloworld组件。

Just unzip the package and rename all the occurrence of hellowolrd from the folder structure if you are using an IDE like Dreamweaver simply achieve this by using folder search options. 如果您使用像Dreamweaver这样的IDE,只需解压缩包并从文件夹结构重命名所有hellowolrd ,只需使用文件夹搜索选项即可实现。

This will rename you complete com_helloworld folder contained helloword text . 这将重命名包含helloword文本的完整com_helloworld文件夹。

The final step is to rename your files all the occurrence of your helloworld in your file you have set to new name of your component. 最后一步是在您已设置为组件新名称的文件中重命名您的helloworld文件。 and the folder too 和文件夹也

Then zip the package and task completed.! 然后压缩包装并完成任务。

Hope this make sense.. 希望这有意义..

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM