Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Use a static subdomain automatically with Asset?
  • I know that you can specify the full URL of the asset in question in order to load it, but how do you configure it to use a different asset base URL without it messing things up? When I change the "url" key/value pair in asset.php to the desired URL, it doesn't use the "assets/default" prefix for the asset directories like it did before I switched things over. I've tried manually specifying it, but when the Asset class tries to process raw data, with \Asset::js($output, array(), nulltrue); it prefixes the raw data it loaded (contained in $output) with the defined url and it says it doesn't exist.

    To me this screams "bug," but I want to make sure. Hopefully it's not and I'm just missing something.

    EDIT: I've made a little progress. I had forgotten to add an entry for my subdomain in my guest system's hosts file, but once I did, I learned that the Asset class doesn't like having the "url" key set to a protocol nonspecific URL. So, to fix that, you need to use the following before the return statement in your asset config and attach it to the URL as appropriate.

    $protocol = empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] === 'off' ? 'http://' : 'https://';

    I'm still plowing through the FuelPHP source code like a wizard to see if I can get it to cough up it's dirty little secrets on why it's malfunctioning.
  • HarroHarro
    Accepted Answer
    That should work, being able to add a URL was added explicitly for this functionality. But I have never used it personally, so I have to dive into the code too.

    If you think it's a bug, please create an issue for it at https://github.com/fuel/core/issues with a use-case describing the problem.
  • Bug report submitted: https://github.com/fuel/core/issues/1802

    EDIT: I've created a simple work around and listed it on the issue's thread for those who are interested.

Howdy, Stranger!

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

In this Discussion