[eluser]Avatar[/eluser]
can we add this to_string() to the mainstream build? it makes accessing sibling modules easier with a string like this,
Code:
modules::to_string('main_module/sibling_module/another_sibling_module');
//returns main_module/modules/sibling_module/modules/another_sibling_module/another_sibling_module
when this string is fed into modules::run it passes it to path_to somehow and adds controller/ between another_sibling_module and another sibling module, making it:
main_module/modules/sibling_module/modules/another_sibling_module/controllers/another_sibling_module
It's more of a convenience to access modules with:
module/module/module
instead of:
main_module/modules/sibling_module/modules/another_sibling_module/another_sibling_module
Code:
function to_string($module, $mod_str = '')
{
$_mods = explode('/',$module);
$pos = strrpos($module, '/');
$fm = substr($module, $pos + 1);
foreach($_mods as $mod => $m)
{
$mod_str .= ($fm != $m) ? $m.'/modules/' : $fm.'/'.$fm;
}
return $mod_str;
}
thank you