开发者

page name, or argumentless URL string in smarty?

开发者 https://www.devze.com 2023-02-02 07:31 出处:网络
I have a search form, and I want to create a \"Start Over\" 开发者_Go百科link that just returns users to the page without any arguments. What Smarty code can I use? For example, if they are at http://

I have a search form, and I want to create a "Start Over" 开发者_Go百科link that just returns users to the page without any arguments. What Smarty code can I use? For example, if they are at http://website.com/search.php?value1=x&value2=y, I want to get http://website.com/search.php or just search.php, so I can construct <a href='{$string}'>Start Over</a>.


I would just fill a variable in your php that you send to smarty? you could get that in smarty I guess, but that's not really a good way. just do something like this:

$yourSmartyVar->assign("string",$_SERVER[’PHP_SELF’])

That should give you the scriptname without querystring if I remember correctly. If it doesn't you could use $_SERVER[’SCRIPT_NAME’] if that suits you better, or even use http://php.net/manual/en/function.parse-url.php

0

精彩评论

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