Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How to run a script in page initialisation
  • I would like to run a package script on each page, after the session is initialised but before the controller gets called. Would the general approach to doing this be to put the package into the "always load" list and put my initialisation code into the package's bootstrap? As a bit of background information, I'm integrating SimpleSAMLphp to implement a single sign-on across a group of sites (Drupal, WP, Fuel and a shop, all on different domains, with a Microsoft CRM authenticating at the end of a web service - it's a fun integration adventure), and on each page load I need to compare the SAML session with the Fuel session. If the user is logged into the SAML session but not the Fuel session, then the user would be logged into the Fuel session immediately, creating a user in the process if necessary (through the auth drivers). As always, I can hack something in, but it helps to know if anyone has any specific experience, advice or gotchas to be aware of. To make any of this code available, I would like to know I'm following best practice for fuel. -- Jason
  • If you'd like to keep things standard, you can do an always_load of the package, and then an always_load of a class in the package. The load of the class will trigger a call to the _init() method, which can contain your code.
  • Works like a dream - thanks.

Howdy, Stranger!

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

In this Discussion