Page 1 of 1

install module serveral times with aliases

Posted: Mon Feb 23, 2009 7:17 am
by skyboy
From time to time i need use one module at serveral instances, For example, news and articles for site can be realized over module {News}. But in present time i have only two ways:
1. Copy whole folder "News" into folder "Articles" in site directory tree. After this i must check ode of module and change all links to DB, friendly names, permissions' declarations etc.
2. Work with one module {News} and divide different entities(news and articles) between different categories. And i'll get some problems on that way:
- can not set permission to different categories: so anybody who can change news, will can change articles.
- templates and additional fields will be joined in one large heap. Working with this heap can be really hard.
- if module can not use hierarchical multilevel categories and i need dividing by categories in each section, i shall create categories like "news_in city" or "articles_health". and i shall cut this prefixes in templates.
As far as i understood second way is really worse.
But edit module each time as i work with other site is really stupid work.
So i suggest extend structure of CMSModule class with method get_alias.
And as get_db_prefix() return value of get_alias() will be used in module code.
For example. Old code:

Code: Select all

$sqlarray = $dict->CreateTableSQL(cms_db_prefix()."module_news", $flds, $taboptarray);
new code:

Code: Select all

$sqlarray = $dict->CreateTableSQL(cms_db_prefix()."module_news_".get_alias(), $flds, $taboptarray);
And other changes made in same way.
This architectural change make "aliasing" really easy: if we'll change return result of get_alias() we'll take new module automatically.

Re: install module serveral times with aliases

Posted: Tue Feb 24, 2009 1:52 pm
by skyboy
please tell me if my english is as poor so you did not understand me .

Re: install module serveral times with aliases

Posted: Tue Jul 28, 2009 9:08 pm
by kendo451
Skyboy, this is a really good idea.  Have you put it in as a feature request?  If not I'll do it for you.

Re: install module serveral times with aliases

Posted: Tue Jul 28, 2009 11:56 pm
by jmcgin51
I agree - this would be an excellent enhancement.