yes your are wrong.
// Name of the module
$modversion['name'] = _MI_PUBLISHER_MD_NAME;
is just the name of the module in user own language and be used just for displaying purposes.
so for example in english it is publisher and in persian it is پابلیشر
you can have 10 clone of the module working with one name publisher
the important part for cloning is dirname:
// Name of the directory that holds the module.
$modversion['dirname'] = basename(__DIR__);
- use basename(__DIR__) for better cloning.
Anyway, IMO the most important module that should follow this standard is TDMCreate as the xoops standard module creator.
Now it will not implement
many of these standards. eg:
$modversion['dirname'] = basename(__DIR__);
edit:
Quote:
All future modules I build from scratch or redo will use this method to allow full cloning by simple renaming of the directory.
As you can see i wrote that all module developers should have a file include/common.php and put all needed definitions like this:
defined("XOOPS_ROOT_PATH") or die("XOOPS root path not defined");
define("PUBLISHER_DIRNAME", basename(dirname(__DIR__)));
define("PUBLISHER_URL", XOOPS_URL . '/modules/' . PUBLISHER_DIRNAME);
define("PUBLISHER_IMAGES_URL", PUBLISHER_URL . '/images');
define("PUBLISHER_ADMIN_URL", PUBLISHER_URL . '/admin');
define("PUBLISHER_UPLOADS_URL", XOOPS_URL . '/uploads/' . PUBLISHER_DIRNAME);
define("PUBLISHER_ROOT_PATH", XOOPS_ROOT_PATH . '/modules/' . PUBLISHER_DIRNAME);
define("PUBLISHER_UPLOADS_PATH", XOOPS_ROOT_PATH . '/uploads/' . PUBLISHER_DIRNAME);
xoops_loadLanguage('common', PUBLISHER_DIRNAME);
include_once PUBLISHER_ROOT_PATH . '/include/functions.php';
include_once PUBLISHER_ROOT_PATH . '/include/constants.php';
include_once PUBLISHER_ROOT_PATH . '/include/seo_functions.php';
include_once PUBLISHER_ROOT_PATH . '/class/metagen.php';
include_once PUBLISHER_ROOT_PATH . '/class/session.php';
include_once PUBLISHER_ROOT_PATH . '/class/publisher.php';
include_once PUBLISHER_ROOT_PATH . '/class/request.php';
$debug = false;
$publisher = PublisherPublisher::getInstance($debug);
So you can use PUBLISHER_DIRNAME anywhere.
But there are
other serious obstacles for cloning.1- mysql.sql have hard-coded tables and you cannot do anything because xoops core will read it in install.
2- you have class names like
class MY_MODULE_classname extends XoopsObject
{
and it will cause issues when you have 2 blocks of the all 2 clones in one page:
Fatal error: Cannot redeclare classMY_MODULE_classname in ...
There maybe other obstacles that i cannot remember. but anyway by following this standard the module will be ready for cloning.
Anyway i think this topic is not a good place to talk about cloning. it is better to continue in another topic.