How to link images in kohana?
I'm getting started using Kohana framework. How do I properly link images? I'm linking images using the usual way:
<img 开发者_如何学编程src="../../resources/images/img01.jpg" />
I'm using dreamweaver, and I can see that the link is correct. Since I can see an image in the preview:
The link is still the same when I reference the image based on the controller.
Best way to use full (base)paths:
<img src="<?php echo url::base() ?>resources/images/img01.jpg" />
or:
<img src="<?php echo url::site('resources/images/img01.jpg') ?>" />
You need to use absolute links. Either use html::image(), or prefix your image with url::base(), or use url::site(). There's lots of options, read the documentation.
精彩评论