• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Making code run on all pages

#1
[eluser]oste15[/eluser]
Hello,

I am wondering what the best way to run code on each page without having to add it into each controller.

For example if you want to check if a user is logged in on each page, and send them to the login page if they are not logged in. You could add the following to each controller, but I think it would be best to just write this once and run it on each page no matter what.

Code:
if(!$user){
//send to login
}

Thanks for clearing this up for me.


Messages In This Thread
Making code run on all pages - by El Forum - 02-16-2010, 03:25 AM
Making code run on all pages - by El Forum - 02-16-2010, 03:32 AM
Making code run on all pages - by El Forum - 02-16-2010, 05:16 PM
Making code run on all pages - by El Forum - 02-16-2010, 06:46 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.