Good day!

Not so long ago, I decided to create a small engine for the rapid development of websites for myself, so that it was not necessary to finish: everything was ready, just plug in modules and plugins ...

And in general, the problem, I just can not think of as it would be better. There are folders

-admin -ModAndPlugin 

In the -admin folder -admin is a file that scans the -ModAndPlugin folder and gets an array from the folders it contains

 array([0]=>"./ModAndPlugin/user/" , [1]=>"./ModAndPlugin/maillent/") 

How to connect modules?

Give links to topics where this has already been discussed, or a finished piece of code.

    2 answers 2

    And why not keep the modules and plugins in the folder, and in the database to describe them, and connect them with links?
    Example:

    /system/exts/mod/modulename/index.php
    /system/exts/pls/pluginname/index.php

    Link:? module = modulename

    and as a variant of its connection with protection against arbitrary launch of functions:

     //$allow_func - массив из имён функций, которые можно запускать $allow_func['show_page'] = 'ok'; $allow_func['users'] = 'ok'; # if (!function_exists($module)) { if (@file_exists("./system/extensions/modules/$module/$module".'.php')) { include "./system/extensions/modules/$module/$module".'.php'; $allow_func[$module] = 'ok';//если модуль существует, то подключить и добавить в список разрешённых для запуска функций } else { return '<strong>Модуль не подключен123</strong><br />'; } } if ($allow_func[$module] == 'ok') { $module(); } 
    • oh, we write to Joomla from scratch) - Sh4dow
    • Oh, and I was hoping that my method was at least a little unique) - Andrei Arshinov
     function __autoload($className){ $filename = "-ModAndPlugin/".$className.".class.php"; if(!file_exists($filename)){ die("lack of required module"); }else{ include $filename; } } 

    And nothing needs to be fenced off.
    When referring to the constructor of a nonexistent class, its file will try to load.