Can somebody explain me what mean this code ? <?php class SocioVO { var $idCodigo; var $apepat; var $apemat; function SocioVO($c, $ap, $am){ $this->idCodigo = $c; $this->apepat = $ap; $this->apemat = $am; } function toString(){ print '<pre>'; print 'Codigo: ' . $this->idCodigo; print 'Apellido Paterno: ' . $this->apepat; print 'Apellido Materno: ' . $this->apemat; print '</pre>'; } } ?> PHP:
It's a class called socioVO. It's so simple that I really don't know how I could explain it more. It should be self explanatory, if not read this: http://php.net/manual/en/language.oop5.basic.php
This is a class that takes code and two names and then prints it. Usage: $objSocioVO = new SocioVO('1921','Vasya', 'Hrenov'); $objSocioVO->toString(); PHP: This class is fine, but kind of weirdly written. toString is usually used as __toString It suppose to be: class SocioVO { var $idCodigo; var $apepat; var $apemat; function SocioVO($c, $ap, $am){ $this->idCodigo = $c; $this->apepat = $ap; $this->apemat = $am; } function __toString(){ $out = '<pre>'; $out .= 'Codigo: ' . $this->idCodigo; $out .= 'Apellido Paterno: ' . $this->apepat; $out .= 'Apellido Materno: ' . $this->apemat; $out .= '</pre>'; return $out; } } PHP: Usage: $objSocioVO = new SocioVO('1921','Vasya', 'Hrenov'); print $objSocioVO; PHP:
Judging by your question even if it did your next question would be "Why changes do I need to make?" then "How do I do that?" then you will disappear and find a new hobby. The class is utterly simple. And actually somewhat pointless. One function sets internal variables that you define. And the other prints a few lines of HTML using the variables you defined. It requires no alterations to run under 5.
My problem is here : https://skydrive.live.com/redir?resid=85993273BA497D13!116&authkey=!AB3YlQn51xQ2exA Using Smarty 2.6 the code works, but using Smarty 3 doesn't work. Can you help me?
This might sound like a stupid question, but what language is that? You've got broken pascal style use of VAR (which is invalid to my knowledge in JS or PHP) with PHP style variable names and use of "$this" -- nothing seems to have any form of scope declared on it, and that in itself might be your problem. ASSUMING that's PHP, shouldn't it read more like this: class SocioVO { private $idCodigo, $apepat, $apemat; public function __construct($c, $ap, $am){ $this->idCodigo = $c; $this->apepat = $ap; $this->apemat = $am; } public function toString() { return '<pre>Codigo: ' . $this->idCodigo . 'Apellido Paterno: ' . $this->apepat . 'Apellido Materno: ' . $this->apemat . '</pre>'; } } Code (markup): If it's actually supposed to output instead of return, switch back to print or better, echo. Though gee, it doesn't work with the stupid bloated nonsensical gibberish asshattery known as 'smarty' -- I'm shocked.