• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
passing data from controller to my library [SOLVED]

#1
how to passing data from controller to my library? 

or

how to get uri segment(3) in library? 

my controller
Code:
$data['page'] = $this->uri->segment(3);

my library

Code:
// How to passing data from controller or uri to $page?
public function popular($page = 2){

}

Thanks before.


SOLVED

in library :
Code:
public function namefunction(){
$this->controller = $this->_CI->uri->segment(3);
}

in controller :
Code:
$data = array (
'page' => $this->uri->segment(3)
)
Reply

#2
@DELE,

Here you go: https://codeigniter.com/user_guide/gener...your-class
Reply

#3
Controller:
PHP Code:
$this->load->library('mylibrary');
$this->mylibrary->popular($this->uri->segment(3));
//or: $this->mylibrary->popular($data['page']); 
Reply

#4
solved tanks master
Reply

#5
If it is solved please explain how you solved it for other users.

Also when solved edit the title of your post and add to the end [SOLVED]
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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