Welcome Guest, Not a member yet? Register   Sign In
controller function is being called two times
#1

[eluser]techpundits[/eluser]
hello...
i am new to code igniter forums and getting this problem.

my controller is called two times.
while debugging my code i placed exit at the last line of my controller.
i.e. after loading view.
but i was unable to see my view.

any help?
thanks..
#2

[eluser]nicholas.byfleet[/eluser]
Please post your code so that I can help you diagnose the problem. Cheers.
#3

[eluser]techpundits[/eluser]
Code:
if($this->uri->segment(3)!=0)
        {
          $videoid = $this->uri->segment(3);
        }
           else {
        //for latest videoid
        $result_videoid=$this->video_Model->get_videos('active',1);
        $video_result=$result_videoid->result();
        $videoid=$video_result['0']->id;
        //for latest videoid
         }

            // this is to increase view count when video is viewed
        $this->video_Model->increase_viewcount($videoid);

            //some data to send here.


            $this->load->view('videos_view',$data);

actually when i use this code viewcount increases two times.
model function is not executing twice.
and i tried exit after loading view suspecting whether controller is loaded twice.
to my astonishment nothing can be seen in the browser other than some print_r things.


thanks for your help.
#4

[eluser]techpundits[/eluser]
this is the detailed code..

Code:
function index(){
        $more=$this->video_Model->more_video();
         if($this->uri->segment(3)!=0)
        {
          $videoid = $this->uri->segment(3);
        }
           else {
        //for latest videoid
        $result_videoid=$this->video_Model->get_videos('active',1);
        $video_result=$result_videoid->result();
        $videoid=$video_result['0']->id;
        //for latest videoid
         }
        $this->video_Model->increase_viewcount($videoid);
            
        $latestvideos = $this->video_Model->get_videos('latest',4);
        print_r($latestvideos->result());
        $topviewedvideos = $this->video_Model->get_videos('top',7);
        
        $videocategeories = $this->video_Model->getvideocategeories(3);
        
        //this is the first categeory which is displayed in the div first on loading the page
        $first_to_display=$videocategeories->result();
        $first_id =$first_to_display['0']->id;
        $onload = "loadVideos('$first_id','".base_url()."videolist/videoview/".$first_id."','".base_url()."videolist/videonamesview','body')";
  
    
        $this->load->library('flash_video');
        $config['id'] = 'n0';
        $config['height'] = '360';
        $config['width']  = '500';
        $config['autostart'] = 'false';
        $config['file'] = base_url().'assets/videos/video'.$videoid.'.flv';//file full path
        $config['skin'] = 'simple';
        $config['previewimage']    = base_url().'assets/videos/image_preview/image'.$videoid.'.jpg';
        $this->flash_video->initialize($config);
        $jslinks = $this->flash_video->getcode();
    
        $data=array( 'title'    =>    'video',
                   'videoplayer' => $jslinks,
                        'more'=>$more,
                  'latestvideos'=>$latestvideos,
                  'videocategeories'=>$videocategeories,
                 'topviewedvideos'=>$topviewedvideos,
                              
                      'onload'=>$onload,
                    
      
        );
          
       $this->load->view('videos_view',$data);
            
        
    }
#5

[eluser]jegbagus[/eluser]
there is a bug when you use mozzila firefox.
i don't know if this bug has been resolved or not yet.
in my experience, when mozilla firefox can't find one of your image / ico or another object, they will send another request (actually became double request).
#6

[eluser]techpundits[/eluser]
thnx.
and please tell me how can i trace the error? any add ons for that?
and whats the error?
#7

[eluser]jegbagus[/eluser]
set debug threshold at your CI become highest, and open it with bare tail.
and you will see, that your browser request the page twice...
#8

[eluser]techpundits[/eluser]
thnx for reply.
but the page is not loading twice.i saw log file with debugging turned to 4.
#9

[eluser]emorling[/eluser]
I am having the same problem, but this is not just in Firefox and does not involve any icons.

See here:
http://ellislab.com/forums/viewthread/112904/P660/




Theme © iAndrew 2016 - Forum software by © MyBB