On Tuesday, November 20, 2012 12:02:34 PM UTC-5, Mark Dexter wrote:
Is this something we will be able to simplify going forward? Perhaps by building this in or something? Thanks. Mark
Building it in to what? I don't really follow the question...so perhaps if I explain my goal?
Because the platform is not namespaced currently, it is rather difficult to play some of the namespace tricks I'm using here. To namespace the platform could be a backwards compatibility pain[though as I've discovered, if your willing to make judicious use of class_alias and the spl autoloader - you can catch attempts to access the global object and dynamically alias the namespaced object to the global root].
I would guess that the only reason this would be "built in" in the future would be if a lot of devs started using the sort of hack I've outlined here to change the underlying platform on running sites.
My goal is create a Joomla library extension...call it "Joomla Platform 12.2 Library"
When installed on a Joomla 2.5 website, it will consist of a single file:
libraries/platform/12.2/joomla.phar
It's a library, it doesn't magically upgrade the CMS to 12.2 - it just means other components can then use it.
Then in MY component controller, I would have[in theory]
namespace gary\joomla\component
require_once JPATH_LIBRARIES.'platform/12.2/joomla.phar';
class SiteconfigControllerConfig extends joomla\joomla\p12_2\JControllerLegacy
And from that point on, all my code will be using the latest platform classes and methods - despite running on Joomla 2.5
Any library setup needed to import the settings from 2.5/11.4 will be handled by the single line:
require_once JPATH_LIBRARIES.'platform/12.2/joomla.phar'
Then if I want to release a version of the same application for Joomla CMS 3.2/platform 13.1 in theory I just change it to:
namespace gary/joomla/component
class SiteconfigControllerConfig extends /JControllerLegacy
Which due to the long unique namespace I setup: joomla\joomla\p12_2 it's rather easy to run a global find and replace.