Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How to use Asset::add_path
  • I don't quite understand how Asset::add($path) works.
    How would use it to access a directory that is at the same directory level as the fuel folder?
  • I don't think that's what it's intended for, rather to add locations of static assets such as js, css, and images that would be under the document root.
  • Correct. Assets should always be accessable by the browser.
  • Can someone give me an example of how to use add_path? In my assets dir I have the following folders: Assets
    ---themes
    admin
    css
    js
    img
    default
    css
    js
    img I like to include the css from admin/css but doing this <?php echo Asset::css('assets/themes/admin/css/style.css'); ?> throws error.
    Fuel\Core\Fuel_Exception [ 0 ]: Could not find asset: assets/themes/admin/css/style.css
    
    What is the use of Asset::add_path? please give an example. Many thanks.
  • Hello I think you would need to use smth like this,
    for example for the backend.:
            \Asset::remove_path('assets/');
            \Asset::add_path('assets/admin/');
    
    and then just echo \Assets:css('style.css'); try to look here: http://fuelphp.com/docs/classes/asset.html maybe you'll find something useful. good luck!
  • Jaroslav Petrusevic wrote on 2011-03-28:
    Hello I think you would need to use smth like this,
    for example for the backend.:
            \Asset::remove_path('assets/');
            \Asset::add_path('assets/admin/');
    
    and then just echo \Assets:css('style.css'); try to look here: http://fuelphp.com/docs/classes/asset.html maybe you'll find something useful. good luck!

    Your suggestion worked perfectly, thank you so much :)

Howdy, Stranger!

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

In this Discussion