【问题标题】:Translate HTML module from Joomla从 Joomla 翻译 HTML 模块
【发布时间】:2012-04-12 01:42:26
【问题描述】:

我需要在 Joomla (1.7) 上的自定义 HTML 模块中插入一个语言字符串。

喜欢:K2_READ_MORE(而不是Read more

怎么做?

【问题讨论】:

  • 您能提供更多信息吗?或者向我们展示您在自定义模块中编写的内容。它可能会帮助我们帮助您。另一方面,对于area51.stackexchange.com/proposals/34294/joomla-answers,这将是一个很好的问题
  • 谢谢,我从来没有读过51区=D

标签: php joomla joomla1.7


【解决方案1】:

你可以这样做:

  1. 创建文件夹

/templates/您的模板/html/mod_custom

  1. 复制以下文件并进行编辑:

/modules/mod_custom/tmpl/default.php

  1. 大约在第 14 行替换:

    内容; ?>

与:

<?php
if(!function_exists('convertJText')) {
    function convertJText($str) { return JText::_($str); };
}
echo preg_replace("/\^\^\^([^\^]+)\^\^\^/ie",'convertJText("$1")', $module->content);
?>

然后您将能够通过使用 ^^^K2_READ_MORE^^^

在自定义 HTML 模块中使用可翻译字符串

【讨论】:

    【解决方案2】:

    试试 Sourcerer 插件:

    http://www.nonumber.nl/extensions/sourcerer

    【讨论】:

    • 在模块中我无法添加 PHP。
    • 我修改了答案,很抱歉我没有看到“自定义”字样。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多