bakercad solution is improved in this way :
Mod_Grabber mod

-----------------------
1) add a table of mods with these fields:
A)name B)author C)information D)version E)active
sample data : archive - bakercad - bakercad's mod - 1.0 - YES
2)add this function to the core :
function mods($variable) {
$mod_active = retrieve('active', 'mods', 'name', $variable);
if (file_exists(db('modpath').$variable.'.php') && $mod_active=='YES')
{ include(db('modpath').$variable'.php');
return true;
}
else {
return false;
}
3)add a section in "administration" in the "site" section below the "Setting" that has name : "Mods"
you should add mods in this variable too.
$l['cat_listSEF'] = 'home,archive,contact,sitemap,rss,login,administration,admin_category,admin_article,article_new,extra_new,page_new,categories,articles,extra_contents,pages,settings,files,logout';
you should write a functions to grab all mods from mod directory.and show in this section and a link to active/deactive each mod.
4)in each function you must do what bakercad did. with this change:
function archive() {
if (!mods ('archive'))
{
echo '
'.l('archive').'
';
}
}
BUT THE MAIN PROBLEM:
mods in general change multiple functions.this is very important consideration in mod management section.
bakercad's solution only consider such mods that only deal with one function.yes it's really easy to change one function with an external php file.but the main problem is designing an architecture that will be independent from the core.there will be conflicts if we don't consider this problem.change each function leads to errors in to many another mods.(it's similar to linux package dependencies!)
A WEAK SOLUTION -Second type of Mods:Plugins
I suggest a weak solution,we have an external php function for each basic function and if any plugin change some function you must change that function in that external file (and don't change the core)
I mean plugins have a shared directory of external functions of main sNews core and if you want to change each function of sNews you must change or create that function in mods directory.if there is not an external function (like archive.php) sNews uses it's original function,but if there is,sNews use that external.
Now when you write a new plugin you must only mention which sections of each function must be changed.the shared mod directory is for this changes.
for example you wrote a plugin with this name : print_friendly
1)this function change functions a,b,c,d.
2)in mods directory you create/change a.php, b.php, c.php, d.php (change when another plugin use the modified a or be or c or d function,create when for the first time this plugin use a modified version)
3)in plugin directory (directory that has print_friendly.php) you create a directory for each plugin to make what you want with this plugins (for example you want use a css,some images and...all connections is handled by print_friendly.php)
4)there will be a plugin management section for active/deactive and ..., and when you deactive it you must manually change external functions.
it maybe there was such errors in my writings and codes and it because when I was writing this post I was in hurry!I hope you understand what I said
