jimy
jimy

Reputation: 4908

How to send a variable from index to controller in opencart

I want to set a variable in index.php and want to access that variable in any controller of open cart.

Upvotes: 1

Views: 1898

Answers (2)

jimy
jimy

Reputation: 4908

i got it we can achieve this by declaring a public variable in controller.php in system/engine/controller.php and then u can access this variable in any controller by simply doing

$this->variable_name = 'foo';

Upvotes: 0

sushil bharwani
sushil bharwani

Reputation: 30187

I think what you are looking for is a session variable.

$_SESSION['your Variable'] = "variable value";

this way you can set it.

You can get it by accessing.

$var_value = $_SESSION['your Variable']

Upvotes: 1

Related Questions