controller.php 582 B

1234567891011121314151617181920212223242526
  1. <?php
  2. dispatch('/', 'hello_world');
  3. function hello_world() {
  4. flash('success', T_('This is a notification'));
  5. set('title', T_('Hello World !'));
  6. return render('homepage.html.php');
  7. }
  8. dispatch('/lang/:locale', 'changeLocale');
  9. function changeLocale ($locale = 'en') {
  10. switch ($locale) {
  11. case 'fr':
  12. $_SESSION['locale'] = 'fr';
  13. break;
  14. default:
  15. $_SESSION['locale'] = 'en';
  16. break;
  17. }
  18. if(!empty($_GET['redirect_to']))
  19. redirect_to($_GET['redirect_to']);
  20. else
  21. redirect_to('/');
  22. }