Thursday 24 March 2011 10:49:30 pm
Creating a config.php and putting some code in it is not hacking, the purpose of this file is to configure your eZ Publish, redirecting to a specific URL in some cases is a kind of configuration.
Yes, I tought about it too... The distro includes config.php-RECOMMENDED so config.php can be changed without fear. But in my opinion redirecting to a specific URL is not config, but rather programming logic, so theoretically it shouldn't be done in config.php And IMHO, if doing the same thing in a template operator can perfectly work (as soon as you use it in the pagelayout), it's not the purpose of a template operator.
There's another issue with the template operator solution. It has to be called in pagelayout, and in eZP the module is executed before parsing pagelayout.tpl, so the redirection will be done only after the execution of module which will degrade performance. For example, for the frontpage first the full node view will be executed and only after that the redirection will be done - which will lead to the mobile version of the forntpage which will again execute the full node view. So allow me to correct myself, this is not the right solution either. Furthermore, both solution wont work when using static cache (or Varnish), so they're not the right way to do it... Which leads me to the conclusion that using apache rewrite rules is the right solution. The only thing in question with rewrite rules is wether the detection can be done properly for all mobile devices. If it's something that depends only on the User-agent string, then it can be done using rewrite rules. But if it requires some more complex logic, then we should look for another solution.
--
Nothing is impossible. Not if you can imagine it!
Hubert Farnsworth
|