[SOLVED] Â Passing Smarty variable to javascript function |
11/5/2007 6:58:59 PM |
PHPRunner General questions | |
F
Fawaz author
I have this field {$row.1clientNote_value} which is a tinytext. <IMG src="include/img/icons/notes.gif" class="hintanchor" onMouseover="showhint('{ldelim}$row.1clientNote_value{rdelim}', this, event, '200px')">
|
|
J
|
Jane 11/6/2007 |
Fawaz, <IMG src="include/img/icons/notes.gif" class="hintanchor" onMouseover="showhint('{ldelim}{$row.1clientNote_value}{rdelim}', this, event, '200px')"> |
F
|
Fawaz author 11/6/2007 |
Fawaz, try to add curly brackets to $row.1clientNote_value variable:
syntax error: unrecognized tag: $row.1clientNote_value{rdelim (Smarty_Compiler.class5.php, line 436)
|
F
|
Fawaz author 11/6/2007 |
Okay, I found a solution, instead of passing Smarty variable to javascript function, I tried the following code, inside the javascript function: {/literal}'{$row.1clientNote_value}' {literal}
|
![]() |
Admin 11/6/2007 |
You placing the closing tag first. {literal}'{$row.1clientNote_value}' {/literal} |
V
|
varzock 11/7/2007 |
Weird, this technique works very well for me. What kind of values you got in that variable? {literal} |
F
|
Fawaz author 11/7/2007 |
Weird, this technique works very well for me. What kind of values you got in that variable? I'm using: {literal}
|
V
|
varzock 11/8/2007 |
Fawaz, could you please show some of your PHP code. It would help sorting out the problem <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=23151&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' /> {foreach from=$row item=hint}
|
F
|
Fawaz author 11/8/2007 |
Fawaz, could you please show some of your PHP code. It would help sorting out the problem <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=23156&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' /> I take it you are generating those hint codes dynamically, possibly using {foreach} Smarty-function? {foreach from=$row item=hint}
{literal}
|