Quote from: kudykam at Sep 05, 2013, 12:57 PM
...
- gets content and tvs from specified resource (for example site.com/category/product123)
- detect /mobile/ in url (site.com/mobile/category/product123) and show this resource with different template
- all this without need to recreate duplicate product resource in /mobile/ folder
Hmm... assuming your requirements this seems like a basic multi-site Modx with shared content approach:
This can be done and would cache well (as cache is something you've indicated as a priority).
You could build two separate sites that both grab content from the same location (ex: the content of each resource says to pull from an optional* third set of resources- including productId or whatever).
You could write a short snippet translating from a given mobile or desktop URL to which resource contains your data. [*: mobile could reference desktop data leaving desktop site alone].
- You would explicitly pull the content from the other resource maintaining complete control of what is displayed in the mobile version. (Probably code this in the template for the bulk of your pages).
- You could simply create separate mobile pages with their own data as desired. (Separate "simpler" template that avoid above alternate resource data call).
In my view, there is not going to be a simplistic** transparent way (hope that is not your goal) to continue writing code that assumes the current resource has the data (at least for one of the sites/sets). But it will be no more difficult in the end if you structure a solution that is clean and consistent- just some slightly different calls. Again, basically multi-site Modx with shared content.
** KISS principle properly applied: Keep it simple s
** KISS principle over applied: Keep it stupid s