Closed alvaro-cuesta closed 12 years ago
Try render title (text)
instead. ;)
That was a simplified example, my interpolated string is much more complex and I can't interpolate into a variable using JS, so... I guess I'm out of luck?
@alvaro-cuesta - You can't use interpolation in parameterized blocks' arguments. BUT... You're probably not out of luck. Could you post your example?
@bminer, it's more or less the same but the interpolated string is not a simple variable. I'm trying to use this in several places:
- var date = new Date
render title("Rándome - #{pageTitle} - #{date.getHours()}:#{date.getMinutes()}")
render random("Your random number is #{parseInt(Math.random() * (max-min) + min)}.")
etc.
Of course I could assemble the strings using plain JS, but interpolation is SOOOO cool I can't live without it :P I guess CoffeeScript (#39 :heart:) would do the trick.
Right, yes. Just assemble the strings using plain JS. String concatenation is cool, too. ;) Remember how hard it was to concatenate strings in C? All this fancy interpolation stuff, geez!
Just...
- var date = new Date
render title("Rándome - " + pageTitle + " - " + date.getHours() + ":" + date.getMinutes())
and similarly...
render random("Your random number is " + parseInt(Math.random() * (max-min) + min) + ".")
So, allow me to revise my prior post...
If you want string interpolation here, you are out of luck. As you pointed out, string interpolation doesn't work in JavaScript.
layout.blade
view.blade
Rendering view.blade yields
<h1>#{text}</h1>
while I would expect<h1>example</h1>
.Am I doing something wrong or is this just not possible in current Blade?