Smarty中的PHP代码 - Urlencode

时间:2014-04-28 23:29:58

标签: php smarty

我有一部分代码混合了PHP和Smarty。如何在Smarty中编写所有代码?

{php}$shortenedurl = file_get_contents('http://url.to/api.php?url=' . urlencode({$ShopURL}/index.php?wlid={$CWunschliste->cURLID});{/php}

<input type="text" id="wunschliste_public_url" value="{php}echo $shortenedurl;{/php}" />

1 个答案:

答案 0 :(得分:0)

你不应该这样使用Smarty。您应该在PHP中执行此类操作并分配Smarty变量。 Smarty是模板引擎,您应该只使用它来显示数据。如果你以这种方式使用模板引擎(Smarty或任何其他),根本就没有必要使用它。它只会影响您的表现,并不会给您带来任何好处。