Welcome Guest, Not a member yet? Register   Sign In
method that loads before controller modules
#7

[eluser]Dyllon[/eluser]
[quote author="pocketmax" date="1263267431"]I have a controller with a bunch of modules in it and I can reduce a lot of duplicate code if there was a central place that I could put a piece of code that would load before my modules do. Is there a way to put code in a method that would run before any of my modules run? So if someone goes to myurl.com/blog/update/

and I in my code...

Code:
class Blog extends Controller {

      function BeforeOtherModules(){
          $this->foo='bar';
      }

      function update(){
          echo $this->foo;
      }
}
[/quote]

I'm guessing by modules you mean methods in which case you can put $this->foo='bar'; in the constructor


Messages In This Thread
method that loads before controller modules - by El Forum - 01-11-2010, 03:37 PM
method that loads before controller modules - by El Forum - 01-11-2010, 03:43 PM
method that loads before controller modules - by El Forum - 01-11-2010, 04:08 PM
method that loads before controller modules - by El Forum - 01-11-2010, 04:11 PM
method that loads before controller modules - by El Forum - 01-11-2010, 04:42 PM
method that loads before controller modules - by El Forum - 01-11-2010, 05:49 PM
method that loads before controller modules - by El Forum - 01-11-2010, 05:57 PM
method that loads before controller modules - by El Forum - 01-11-2010, 06:08 PM
method that loads before controller modules - by El Forum - 01-11-2010, 06:27 PM
method that loads before controller modules - by El Forum - 01-12-2010, 02:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB