Welcome Guest, Not a member yet? Register   Sign In
scope
#1

[eluser]Doodlez[/eluser]
All this function does is set the doc type and page header I figure since I will call it constantly I could just create a function that creates a view and passes it my variables. My problem is that I don't under stand the scope of the Controller object(at least I think thats what I mean) Where would this code be placed? Is this a helper?


function declareHeader($pageTitle,$metaData){

$decleration=array(
'pageTitle'=> $pageTitle,
'metta'=> $metaData
);

$this->load->view('decleration',$decleration);

}
#2

[eluser]mddd[/eluser]
Why not load the variables directly:
Code:
$this->load->vars( array('pageTitle'=>'My Page Title', 'meta'=>'<my meta tags>') );

After this line, every view you load will have a $pageTitle and $meta set to the right values.




Theme © iAndrew 2016 - Forum software by © MyBB