Welcome Guest, Not a member yet? Register   Sign In
variables from controler not appearing in view
#3

[eluser]Unknown[/eluser]
yes, that's what I was doing. and it didn't work.
after the extract() is executed in the CI core function "load()", some variables which should have been copied from the array to the current scope are missing.
and I don't know why.

simple way:
$vars[ 'var1' ] = "content1";
$vars[ 'var2' ] = "content2";
$this->load->view( 'view_page', $vars );

view_page:
echo( $var1 );
echo( $var2 );


if I add some more variables, some are not sent to the view.
like in this this case, I could add:
$vars[ 'another_var' ] = array( 'test' => 'hope it works' );

and suddenly, echo( $var2 ); doesn't work anymore because $var2 is not present in the view.



Messages In This Thread
variables from controler not appearing in view - by El Forum - 04-10-2013, 04:18 AM
variables from controler not appearing in view - by El Forum - 04-10-2013, 04:24 AM
variables from controler not appearing in view - by El Forum - 04-10-2013, 05:13 AM
variables from controler not appearing in view - by El Forum - 04-10-2013, 08:02 AM
variables from controler not appearing in view - by El Forum - 04-10-2013, 09:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB