2014-07-16 11:48
浏览 27


I have a language file called theme.php and in this file there is the line

$LANG['sources_HAVE_AN_ACCOUNT'] = "Have an account?";  

Now in the file called votes.php i am using the code:

 if($r) //voting done
 echo "". $LANG['sources_HAVE_AN_ACCOUNT']." <a href='../login' target='_blank'  #0087F7; text-decoration: none; font-weight: bold;'>".$LANG['header_LOGIN_title']."</a>";
 elseif(!$r) //voting failed
 $effectiveVote = getEffectiveVotes($id);
 echo $effectiveVote." ".$LANG['sources_POINTS_title'];

to allow users to perform a vote in a specific article.

The problem is that when you click on the vote button the text “Have an account?” doesn’t appears!!

Why is this happens? Where is the problem?

图片转代码服务由CSDN问答提供 功能建议

我有一个名为theme.php的语言文件,在这个文件中有一行 \ n

  $ LANG ['sources_HAVE_AN_ACCOUNT'] =“有帐户吗?”;  


  if($ r)  //投票完成
 echo“”。  $ LANG ['sources_HAVE_AN_ACCOUNT']。“&lt; a href ='.. / login'target ='_ blank'#0087F7; text-decoration:none; font-weight:bold;'&gt;”。$ LANG ['header_LOGIN_title  ']。“&lt; / a&gt;”; 
 elseif(!$ r)//投票失败
 $ effectiveVote = getEffectiveVotes($ id); 
 echo $ effectiveVote。“”。$  LANG ['sources_POINTS_title']; 



为什么会发生这种情况? 问题出在哪里?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douxin1884 2014-07-16 12:44

    Several things to check :

    • Your theme_lang.php file must be located into application/language/english/
    • Add theme to the $autoload['langage'] array located in application/config/autoload.php
    • Check in application/config/config.php that your $config['language'] is set to english

    Then, to use the translations in your votes.php controller, use this :


    You can find more info in the Language Class documentation of Codeigniter

    点赞 打赏 评论