开发者

How to build url in smarty template?

开发者 https://www.devze.com 2022-12-20 01:06 出处:网络
In template I have two strings which I want to combine in one. {assign var=\"bigUrl\" value=\"Search?开发者_StackOverflowsearchFor=Member&{$searchUrl}\"}

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

精彩评论

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

关注公众号