开发者

How to build url in smarty template?

In template I have two strings which I want to combine in one.

{assign var="bigUrl" value="Search?开发者_StackOverflowsearchFor=Member&{$searchUrl}"}

To be able to use variable {$bigUrl} below in template, like this:

<a href={$bigUrl}>Link</a>

When I write mentioned assignment smarty compiler report error:

syntax error: invalid attribute name: '='


You can't use braces inside smarty tags. Just remove them:

{assign var="bigUrl" value="Search?searchFor=Member&$searchUrl"}

Or use cat filter:

{$bigUrl|cat:$searchUrl}


I'm not sure this is it, but in the Smarty manual all {assign}s are in single quotes. The error message would make sense if those don't work.

Can you try replacing the double quotes?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜