Last active
August 29, 2015 14:20
-
-
Save MikSDigital/0c176783f6fa488b2903 to your computer and use it in GitHub Desktop.
employee.class.php and snippet to access this class (just test)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* class file in assets/classes/ folder */ | |
class employee { | |
public $name; | |
public $surname; | |
private $date; | |
function __construct(modx &$modx, array $config = array()) { | |
$this->modx = & $modx; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$path = MODX_ASSETS_PATH.'classes/'; | |
$modx->loadClass('employee',$path,true,true); // загружает файл employee.class.php из папки assets/classes/ | |
// но я также встречал и вот такую конструкцию: $this->modx->loadClass('xmlrss.modRSSParser','',false,true); | |
// $this->rss = new modRSSParser($this->modx); | |
// где в качестве параметра передается $this->modx | |
$e=new employee($MODX); | |
$e->name = 'Имя'; | |
return $e->name; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment