Joomla - 覆盖 getItem 方法 [英] Joomla - Overriding getItem method

查看:18
本文介绍了Joomla - 覆盖 getItem 方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想覆盖文件 administratorcomponentscom_contentmodelsarticle.php 中的 getItem() 方法

I want to override the method getItem() found in file administratorcomponentscom_contentmodelsarticle.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?

我使用的是 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

希望它也能帮助其他人.

Hope it helps others too.

非常欢迎任何更好的想法.

Any better ideas are highly welcome.

这篇关于Joomla - 覆盖 getItem 方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆