1

I have a view page below which automatically detects the current user timezone and after detecting timezone , i am sending it to another page for setting the timezone in session for further use.

here is the file(autodetect.php)

<!DOCTYPE html>
<html>
<head> 
    <title>   
    <script type="text/javascript" src="....jquery.js' ?>"></script>  
      <script type="text/javascript"       src='..autodetect/Jsfile/detect1.0.4.min.js'>   
</script> 
 <script>  
 $(function() {   

   <?php if (!isset($_SESSION['tz'])) { ?>
        var timezone = jstz.determine(); 
        $.ajax({
            type: "POST",
            url:"<?php echo base_url('timezone.php'); ?>",
            data: 'timezone='+timezone.name(),
            success: function(data){ 
            }
        }); 
        <?php } ?>   
    }); 
 </script>   
 </head> 
 <body>  
 </body>

,in order to perform this functionality i have to load/read this page(autodetect.php) first,

so my question is "how can i run this page(i.e autodetect.php) before loading any view page or calling any view page via controller?

eg. i have to load the signup page , but before then this i need to read the above php file in order to detect the current timezone of user.

3
  • Hi All! If my above question is not clear, please write comment for me, so that i will try to explain you in a different way. Thanks
    – beginner
    Sep 9, 2013 at 22:37
  • Apparently, this has been answered here: stackoverflow.com/questions/13/…
    – rfpdl
    Sep 10, 2013 at 0:34
  • @Ponce That is not similar with my problem. I am asking a diffrent thing
    – beginner
    Sep 12, 2013 at 6:19

1 Answer 1

0

To load any script before loading any view page, you can use Hooks:

Hooks - Extending the Framework Core

And choose the appropriate hook point for your need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.