doutou7961 2017-09-29 21:14
浏览 137
已采纳

MyBB论坛新语言的价值

I want to add a new language value (English and German) for a navbar. Now I added a new file named navbar.lang.php with this code:

<?php
/**
 * MyBB 1.8 English Language Pack
 * Copyright 2014 MyBB Group, All Rights Reserved
 *
 */

$l['navbar_home'] = "Home";
$l['navbar_forum'] = "Forum";
$l['navbar_contact'] = "Contact";
$l['navbar_more'] = "More";
$l['navbar_privacy_policy'] = "Privacy Policy";
$l['navbar_terms_of_use'] = "Terms of Use";
$l['navbar_team_members'] = "Team Members";

?>

then I added in the header template this code:

<a class="active" href="{$mybb->settings['bburl']}"> {$lang->navbar_forum}</a>

But the the a tag is empty and I don't know why. If I look into the page the code looks like this:

<a class="active" href="http://127.0.0.1/forum"></a>

Why is this? If I use another language variable like {$lang->online_online_plural} nothing happens either but I don't know why. I already asked in the MyBB Forum but I didn't get a answer there.

  • 写回答

1条回答 默认 最新

  • dtdt0454 2017-11-29 11:11
    关注

    First you nedd to put your nav.lang.php files in the right directory inside the language > english/german. Then open up your index.php then insert this code

    $lang->load('navbar');
    

    after the code

    $lang->load('index');
    

    then your go.

    Note: if you want to show this value in all pages then you should add it in global. Hope it help

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题