duanlang1196 2011-01-24 03:29
浏览 14

需要帮助javascript提示与PHP

i am using javascript field hint. problem occurred when I try to put code php translation into the hint itself.

<?php $interest= '<span class="hint">Eg: Cooking or Singing or Dancing<span class="hint-pointer">&nbsp;</span></span>';?>

if i try to put

 <?php    
$interest = '<span class="hint">__("Eg: Cooking or Singing or Dancing")<span class="hint-pointer">&nbsp;</span></span>';?>

the field hint at page will be displayed like this "__("Eg: Cooking or Singing or Dancing")"

if i try to put

$interest = '<span class="hint">__('Eg: Cooking or Singing or Dancing')<span class="hint-pointer">&nbsp;</span></span>';?>

or

$interest = '<span class="hint">' __('Eg: Cooking or Singing or Dancing')'<span class="hint-pointer">&nbsp;</span></span>';

error will be displayed:

Parse error: syntax error, unexpected T_STRING in C:\wamp\www\estandard\app\views\companies\company.ctp on line 7"

thanks in advance.

  • 写回答

2条回答 默认 最新

  • doutuobao9736 2011-01-24 03:32
    关注

    Try this:

     $interest = '<span class="hint">'.__('Eg: Cooking or Singing or Dancing').'</span>';
    

    That is if you want the value of interest to the be localized version of the string 'Eg: Cooking or Singing or Dancing'.

    评论

报告相同问题?

悬赏问题

  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程
  • ¥20 模型在y分布之外的数据上预测能力不好如何解决