将当前路径作为参数传递给流星模板

时间:2015-08-21 14:23:02

标签: meteor

如何在

中传递流星模板中的当前路径
{{> sometemplate somearg="{{currentpath}}" }}

当前路径基本上是window.location.pathname

返回的路径

1 个答案:

答案 0 :(得分:0)

您可以使用简单的帮助:

{% cache 300 request.build_absolute_uri request.user %}
<html>
 {% block content %} {% endblock %}
</html>   
{% endcache %}  

使用以下方法在模板中调用它:

import mechanize
import urlparse
from bs4 import BeautifulSoup

op = mechanize.Browser()
op.open("https://www.mentalhelp.net/symptoms/")
for link in op.links():
print link.text
print urlparse.urljoin(link.base_url, link.url)
get = BeautifulSoup(urllib2.urlopen("https://www.mentalhelp.net/symptoms/").read()).findAll('p')
print get
print "\n"