I have left_sidebar.php file where i have echo all the left_sidebar.php content through variable $content, after including left_sidebar.php in index.php file through php include ('left_sidebar.php'), the issue here is that the variables $content that i have used in left_sidebar.php file causing issue of undefined on index.php view.
Controller
public function LeftSidebarData()
{
$url1 = 'url to pick the data';
$curl_hand = curl_init($url1);
curl_setopt($curl_hand, CURLOPT_TIMEOUT, 5);
curl_setopt($curl_hand, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($curl_hand, CURLOPT_RETURNTRANSFER, true);
$data1 = curl_exec($curl_hand);
curl_close($curl_hand);
$content['searchingtype'] = (array) json_decode($data1,true);
$this->load->view('left_sidebar.php',$content);
}
This controller is providing data to left_sidebar.php file correctly. but My problem is when i include this left_sidebar in index.php as include(left_sidebar.php) file it gives undefined variable searchingtype on line 20 left_sidebar.php.
here is my index.php code: