On Fri, Oct 16, 2009 at 2:04 PM, Baluta Cristian
<cristi...@gmail.com> wrote:
Hi, i've guessed from the build.sh file that i need a resources folder with photos and other stuffs from the website. i've created resources/gfx/logo.png and i'm loading it with <img src="gfx/logo.png">
the gfx folder is copied correctly in www and the logo is also displayed in page, the problem comes when i call my page with www/index.php
it tries to load index.php/gfx/logo.png, which obviously is not working (not sure why safari doesn't tell me about the wrong path)
That's true, I get the same thing but with a quirk: If I request the index page without an appending slash, it works:
http://localhost/index.php - "gfx/logo.png" is displayed.
http://localhost/index.php/ - "gfx/logo.png" it's not.
So I guess the browser thinks that index.php is a path when resolving the relative path, if a slash is appended... Anyway, the problem is alleviated by using Url.linkUrl(). If you assign it to the view like this:
this.view.assign('linkUrl', haxigniter.libraries.Url.linkUrl());
Then you can prepend that value to all your links and they will work no matter in what subdirectory you put them:
<img src="::linkUrl::/gfx/logo.png">
If you use a wysiwyg editor for the views, it might not like that however. Then you have to resolve to using absolute paths in the images (and js, css, and other resources):
<img src="/gfx/logo.png">
The problem with this approach is that if you're moving the project into a subdirectory, you have to rename all links of course. With the ::linkUrl:: method it's done automatically.
/Andreas