I know this is a wierd form of doing thing. Let me explain:
Im using xajax class, and i just made a custom class called mantenimientos that use objects of this xajax class.
Something like this:
class mantenimiento
{
public $titulo;
public $ajax_sRequestURL;
function __construct($titulo,$ajax_url){
$this->titulo = $titulo;
$this->ajax_sRequestURL = $ajax_url;
}
function exec_ajax(){
//Here i can use $this with no problem
$xajax = new xajax($this->ajax_sRequestURL);
$xajax->registerFunction("call_fun");
//I have to do this to have acces to the class itself when im inside a function
global $mant ;
$mant = $this;
function call_fun(){
//next line give me access to the mantenimiento class properties.
//I havent found other way of doing it.
global $mant;
$objResponse = new xajaxResponse();
$objResponse->addAlert('XAJAX CALLED:'.$mant->titulo);
return $objResponse->getXML();
}
$xajax->processRequests();
}
My problem is that $mant->titulo lost it value when i im inside the funciton, but only when that value comes from other var.
for example:
if i do this:
$mant = new mantenimiento('This is the title','index.php');
or
$titulo = 'This is the title';
$mant = new mantenimiento($titulo,'index.php');
When i execute the xajax_call_fun, it shows an alert box with the text "XAJAX CALLED:This is the title"
but if i do something like this:
$titulo = gettitulo_from_database();
or
$titulo = $_POST['titulo'];
The alert box show the mensaje with out the value of the $mant->titulo
Im getting crazy with this....!!!
I use php5.
HEEEEEELP PLEASE