[英]How to get base URL in a Lithium template/view?
I want to access a folder named 'Videos'. 我想访问一个名为“视频”的文件夹。 It is placed parallel to images/scripts etc. I can send the base url in a variable from the controller but it doesn't make sense.
它与图像/脚本等平行放置。我可以从控制器以变量形式发送基本url,但这没有任何意义。 Is there a way I can access the folder in a template/view?
有什么方法可以访问模板/视图中的文件夹?
To generate a base URL, you can do $this->url("/")
, but for paths to assets, there's $this->path("/")
, which hooks into the Media
class. 要生成基本URL,可以执行
$this->url("/")
,但是对于资产的路径,有$this->path("/")
,它可以链接到Media
类。 Often these values will be the same, but Media
allows you to have more sophisticated asset configurations, and path()
keeps your generated paths in sync with it. 通常,这些值是相同的,但是
Media
允许您进行更复杂的资产配置,而path()
可使生成的路径与其保持同步。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.