<?php
 
    class module{
        

        public $use_path;
        public $dir;
        static $instance , $i;
        
        /**
         * 
         */
        public function __construct(){

            $this -> dir = DIR_MODULE;
            $this -> use_path = $this -> dir . (file_exists($this->dir . core::$instance->mode) ? core::$instance->mode : _cfg::$i->module->default) . '/';
            
            self::$instance = $this;
            self::$i = $this;
            
        }
        
        public function useThis(){
            
            if( file_exists( $this->use_path . core::$instance->function . '.php' ) ){
                require_once $this->use_path . core::$instance->function . '.php';
            } else core::page404();
            
            
        }
        public function on(){
            global $tpl;

            page::$instance->val( $tpl->fetch( $this->use_path . core::$instance->function . '.tpl' ) );
            
        }
        
        
    }



?>