install module serveral times with aliases

General project discussion. NOT for help questions.
Post Reply
skyboy
Forum Members
Forum Members
Posts: 39
Joined: Mon Dec 01, 2008 11:41 am

install module serveral times with aliases

Post 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.
skyboy
Forum Members
Forum Members
Posts: 39
Joined: Mon Dec 01, 2008 11:41 am

Re: install module serveral times with aliases

Post by skyboy »

please tell me if my english is as poor so you did not understand me .
kendo451

Re: install module serveral times with aliases

Post 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.
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: install module serveral times with aliases

Post by jmcgin51 »

I agree - this would be an excellent enhancement.
Post Reply

Return to “General Discussion”