Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Setting a URL in assets_folder does not change the base url of the assets as specified
  • Hello guys, Here is the documentation that describes this feature:
    http://docs.fuelphp.com/classes/theme/introduction.html#/assets I would like to point out that setting the assets_folder in a theme.php configuration file does not change the base url of the assets instance within the themes instance. fuel/core/theme.php
      // Order of this addition is important, do not change this.
      $this->config = $config + $this->config;
    
      // define the default theme paths...
      $this->add_paths($this->config['paths']);
    
      // create a unique asset instance for this theme instance...
      $this->asset = \Asset::forge('theme_'.spl_object_hash($this), array('paths' => array()));
    

    The current code does not pass the assets_folder or anything through to $this->asset. fuel/core/asset.php
    public static function forge($name = 'default', array $config = array())
    {
     ...
    
     static::$_instances[$name] = new \Asset_Instance(array_merge(static::$default_config, \Config::get('asset'), $config));
    
     ...
    }
    

    It did not send any configuration about the assets_folder, nor anything else that would change the base_url of the assets folder. It seems that it needs the 'url' config key to change the asset base url... fuel/core/asset/instance.php
    ...
    
    protected $_asset_url = '/';
    
    ...
    
    public function __construct($config)
    {
     ...
    
     $this->_asset_url = $config['url'];
    
            ...
    }
    

    What could be the problem? Thanks
  • The Theme class determines the asset location by using "asset_base" and "asset_folder", when constructing the theme definition. This results into "asset_path", which is passed to the Asset instance in set_theme(), not when instantiating the object (because that that moment the active theme isn't known yet).

Howdy, Stranger!

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

In this Discussion