Joomla - 覆盖getItem方法 [英] Joomla - Overriding getItem method
问题描述
我想覆盖文件\administrator\components\comcomment/\\models\article.php中的方法getItem()
I want to override the method getItem() found in file \administrator\components\com_content\models\article.php
line 257 public function getItem($ pk = null)
我需要修改返回值基于变量$ pk的值。
I need to modify the return value based on the value of variable $pk.
我该如何做?
我希望找到一种不修改核心的方法。
I am hoping to find a way to not to modify the core.
此外,如果可以覆盖,我可以从中创建一个插件吗?
Also, if override is possible, can I make a plugin out of it?
Am使用Joomla 2.5 .9
Am using Joomla 2.5.9
推荐答案
有了更多的搜索,遇到了一个漂亮的解决方案。
With some more searching, came across a beautiful solution.
我需要的是覆盖com_content下的模型(article.php)。
All I needed was to override the model (article.php) under com_content. This got it done.
使用插件覆盖插件Joomla核心可以覆盖。在 digitaldisseny上发现了一篇很棒的文章
Using the Plugin Override plugin the Joomla core can be overridden. Found a great article on the same on digitaldisseny
重写Joomla的文档!核心的MVC使用的是这里
The documentation on overriding Joomla! core's MVC using this is here
希望它也帮助别人。
欢迎任何更好的想法。
这篇关于Joomla - 覆盖getItem方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!