开发者

need help with javascript hint with 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 displa开发者_StackOverflowyed:

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

thanks in advance.


The error for the last example is caused by missing your concatenation symbol. This should work:

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


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'.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜