PHP Fatal error: Smarty error: syntax error: unidentified token '=' - smarty

Could someone point me in the right direction.
{if $current_url == '/movies' || $current_url == '/tv-shows' || $current_url == '/movie/$mov.title|replace:' ':'-''}
Could someone tell me what i'm doing wrong to get this error because i'm new to coding.
PHP Fatal error: Smarty error: syntax error: unidentified token '='

You're using quotes wrong. This is not valid, because you're embedding single quotes inside single quotes:
$current_url == '/movie/$mov.title|replace:' ':'-''
Instead, you should use this:
$current_url == '/movie/'|cat:$mov.title|replace:' ':'-'
Or the somewhat shorter version with backticks:
$current_url == "/movie/`$move.title`":$mov.title|replace:' ':'-'

Related

RPAREN error when compiling code

I am currently trying to build and conplie a code for my game inb UDK but i keep getting this error Parser: missing RPAREN at '{'
I have a copy of the code that is creating the problem located below.
{
if (Stamina - StamJumpPenalty > 0 && super.DoJump(bUpdating)
{
Stamina -= StamJumpPenalty;
return true;
}
return false;
}
can some one please help me out, and maybe explain why this is happening please?
thanks guys
You're missing a closing parenthesis in the condition of the if statement.

DataMapper validation errors with brackets

I'm using DataMapper's validations, but I can't get the error messages text :(
I tried:
#error = user.errors.first
#error = user.errors.full_messages.first
#error = user.errors.full_messages.flatten
#error = user.errors[0]
But still I get an array :(
In my template I have
- if #error
%p.lead= #error
And I get ["This username is taken"]
If I have
- if #error
- #error.each do |er|
%p.lead= er
it works, but isn't there a way to send only a string to the template and it to work with the %p = #error ?
If #error is an array, which it seems to be, then that's how it will show up.
What you probably want is:
#error = user.errors.full_messages.flatten.join(', ')
Something like that will collapse it to a string. flatten returns an Array.

access my custom variables in jmeter's if controller

I try to simply access a custom variable in the if controller:
${MyVar} == "none"
it seems to always return false (the children don't run even if i replace it with ${MyVar} != "none"), and I see no errors in my jmeter.log file
Am I doing something wrong
The code generates an exception
2013/08/14 20:50:43 ERROR - jmeter.control.IfController: If Controller: error while processing [none == "none"]
org.mozilla.javascript.EcmaError: ReferenceError: "none" is not defined. (<cmd>#1)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3687)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3665)
at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3750)
Use doule quotes around the variable and it should fix the problem.
"${MyVar}" == "none"

coffeescript: why does "str".replace(/ /g, "") give coffeescript compile error?

The offending line
"str".replace(/ /g, "")
gives
Error: In orders.js.erb.coffee, Parse error on line 463: Unexpected 'MATH'
at Object.parseError (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/parser.js:466:11)
at Object.parse (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/parser.js:542:22)
at Object.compile (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:38:22)
at /usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:149:33
at /usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:115:19
at [object Object].<anonymous> (fs.js:107:5)
at [object Object].emit (events.js:61:17)
at afterRead (fs.js:878:12)
at wrapper (fs.js:245:17)
Is this a bug in the coffeescript compiler or am I missing something?
Escape the first whitespace inside of the regexp
"str".replace(/\ /g, "")
compiles just fine.

AND Operator in af:resource in javascript throwing error

within af:resource component in javascript, use of the && for comparison throws the following error:
Expected name instead of &
The second ampersand is highlighted with a wavy red underscore when this error is thrown.
The sample code is shown below.
blnTargetRowReady = (targetIndex==1 && targetDestinationComponent.getValue()==null && targetOriginComponent.getValue()==null && targetSelectComponent.checked==false && targetDateComponent.getValue()!=null);
I notice when i subsitute the && with || this error does not occur.
Does anyone know why this error occurs on the page. The page runs fine when run in the browser, ie with the ampersand, but in JDeveloper the relevant page shows up with an error.
Any guidance you can provide i would appreciate it.
In your code, try to replace each ampersand with &
blnTargetRowReady = (targetIndex==1 && targetDestinationComponent.getValue()==null && targetOriginComponent.getValue()==null && targetSelectComponent.checked==false && targetDateComponent.getValue()!=null);

Resources