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. Is there a way I can access the folder in a template/view?
Asked
Active
Viewed 364 times
1 Answers
4
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. 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.

Nate Abele
- 5,771
- 32
- 27
-
Thanks a lot Nate! Where do I look in the documentation for these methods? The documentation needs a search! – Rutwick Gangurde Jul 06 '15 at 13:03
-
2Yeah I agree it needs a little help. Here you go: http://li3.me/docs/lithium/net/http/Media::path() – Nate Abele Jul 07 '15 at 00:09
-
1Technically... `$this` in the template refers to an instance of `lithium\view\Renderer` and the `url()` and `path()` functions are defined in the `_init()` method. See http://li3.me/docs/lithium/template/view/Renderer::_init(). When you call `$this->path()` in a template, it's invoking `Renderer::__call()` which finds `$this->handlers['url']` and invokes that, which calls `Media::asset()`, which calls `Media::filterAssetPath()` and ultimately `Media::path()`. All the hooks for filters and dependency injection make the li3 source a little tricky to follow, but they have a purpose. – rmarscher Jul 08 '15 at 22:03