Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Base URL and HMVC
  • Is there any way to fetch the base url of the project from an hmvc context without setting the base_url config option?  I moved a view creation to hmvc context and now the links are broken.

    Thanks,
    Tony
  • My bad.  Misread the cause.  No wonder it was so frustrating.  Followup question: is there any way to get the base_url of the server from inside of a task?

    Thanks,
    Tony
  • HarroHarro
    Accepted Answer
    In the "frontend", you can use Uri::base() to get the generated base url, either from what you have defined, or by using an auto-detection mechanism.

    That mechanism doesn't work in anything that runs from the commandline (including tasks), because there is no webserver and no web host context, so no way to auto detect your base url. The only way around that is to hard code it, or to have your frontend cache it somewhere so that your tasks can pick up the base url stored at runtime...

Howdy, Stranger!

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

In this Discussion