Skip to content

Instantly share code, notes, and snippets.

@MikSDigital
Last active August 29, 2015 14:20
Show Gist options
  • Save MikSDigital/0c176783f6fa488b2903 to your computer and use it in GitHub Desktop.
Save MikSDigital/0c176783f6fa488b2903 to your computer and use it in GitHub Desktop.
employee.class.php and snippet to access this class (just test)
<?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;
}
}
<?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