【发布时间】:2014-04-10 15:15:57
【问题描述】:
在 components/com_content/models/article.php 中有一个名为 storeVote 的函数,它存储从 0 到 5 点的投票。这是该函数的第一行:
if ( $rate >= 1 && $rate <= 5 && $pk > 0 )
我为 Joomla 2.5 编写的插件可以存储从 0 到 5 和 0 到 10 的投票,所以我需要将该行修改为:
if ( $rate >= 1 && $rate <= 10 && $pk > 0 )
在安装插件时自动。
我该怎么做?
提前致谢。
警察局
这是我需要在Joomla中实现的代码,但我不知道如何实现,有帮助吗?
$searchString='if ( $rate >= 1 && $rate <= 5 && $pk > 0 )';
$replaceString='if ( $rate >= 1 && $rate <= 10 && $pk > 0 )';
$fh = fopen("article.php", 'r+');
$file = file_get_contents('article.php');
$file = str_replace($searchString, $replaceString, $file);
fwrite($fh, $file);
fclose($fh);
【问题讨论】:
标签: plugins joomla2.5 joomla-extensions