Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
1.7.2 Document root prepended to asset URL
  • Hello,

    I have updated to fuel 1.7.2 and Fuel has started prepending the document root to the asset paths:

    \Theme::instance()->asset->get_file( 'logo.jpg', 'img' )

    /var/www/myweb/codebase/themes/red/img/logo.jpg

    In the diff it looks like this line 464 was removed from /core/classes/asset/instance.php:

    strpos($newfile, DOCROOT) === 0 and $newfile = substr($newfile, strlen(DOCROOT));

    Is this a bug?

    Jon.
  • No, not a bug, a functional change. I now see it wasn't mentioned in the change log.

    It was decided that get_file() should get the file. Completely. Stripping the DOCROOT from it is a rendering issue, where you need to path relative to the DOCROOT. So this functionality has been moved to the render method.

    So if you do the rendering yourself, you need to strip the DOCROOT yourself. Or extend the Asset_Instance() class, and add a get_relative_file() method or something, that does this for you.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion