system/library/mylibrary.php
<?php
class Mylibrary {
private $config;
private $db;
private $data = array();
private $log;
public function __construct($registry) {
$this->config = $registry->get('config');
$this->customer = $registry->get('customer');
$this->session = $registry->get('session');
$this->db = $registry->get('db');
$this->tax = $registry->get('tax');
$this->weight = $registry->get('weight');
$this->log = $registry->get('log');
// ... зависит от того, доступ к каким данным вам понадобится в вашей библиотеке.
}
public function write_text($string) {
print_r($string);
}
}
?>index.php
require_once(DIR_SYSTEM . 'library/cart.php');
require_once(DIR_SYSTEM . 'library/mylibrary.php'); // +
...
// Cart
$registry->set('cart', new Cart($registry));
// Mylibrary // +
$registry->set('mylibrary', new Mylibrary($registry)); // +admin/index.php
по аналогииcatalog/controller/common/header.php
$this->mylibrary->write_text('ololo');admin/controller/common/header.php
$this->mylibrary->write_text('abc');