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"> </span></span>';?>
if i try to put
<?php
$interest = '<span class="hint">__("Eg: Cooking or Singing or Dancing")<span class="hint-pointer"> </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"> </span></span>';?>
or
$interest = '<span class="hint">' __('Eg: Cooking or Singing or Dancing')'<span class="hint-pointer"> </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"> </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'.
精彩评论