[eluser]Unknown[/eluser]
hi, i have no idea why this controller isn't working as I expected :gulp:
it s a simple class with an attribute and 4 methods: set(), get(), index (), and the constructor.
Code:
<?php
class Text extends Controller {
var $a="foo";
function text()
{
parent::Controller();
$this->load->helper(array('form', 'url'));
}
//______________________________________________________
function index()
{
$this->load->view('formtext');
}
//_____________________________________________________
function set()
{
$this->a="Value";
echo 'Variable set';
}
//______________________________________________________
function get()
{
echo '<br>'.'a='.$this->a;
}
}
?>
The view is:
Code:
<html>
<head>
<title> Title </title>
</head>
<body>
<?echo anchor('text/set', 'Set ( a ) ');echo '<br>'; ?>
<?echo anchor('text/get', 'Get ( a )!');echo '<br>'; ?>
</body>
</html>
Once both of the links from the view are clicked, I was expecting
to be displayed
Quote:a="Value"
, but instead of this, i
get for the "a" attribute the same value as it was at the begining.
It's the first time i'm using php classes, so I must be very wrong about smth..
Anyway, the reason I'm testing this is because
I only need a way to transmit a parameter from
one function to another inside a controller
(can t be that hard ;-P !!!), maybe a global variable?
Thx in advance