Welcome Guest, Not a member yet? Register   Sign In
Is there a way to pass every variable in a controller action, to the view automatical
#1

Is there a way to pass every variable in a controller action, to the view automatical

So instead of 

PHP Code:
<?php
class News extends CI_Controller {
 
       public function index()
 
       {
 
               $data['test'] = "hello";
 
       }

I can have


PHP Code:
<?php
class News extends CI_Controller {
       public function index()
       {
               $test = "hello";
       }




And I can echo $test in the view and the word "hello" appears as the variable is passed automatically to the view without me having to manually pass it myself.
Reply


Messages In This Thread
Is there a way to pass every variable in a controller action, to the view automatical - by desbest - 06-16-2017, 11:47 AM



Theme © iAndrew 2016 - Forum software by © MyBB