should be able to use $this->request->getVar('version') in your controller to get the value. You could them look to use this in a switch statement to change the template rendering. You should also check to see if the variable exists before running through the switch and have a default template to render if nothing is supplied.
$version = $this->request->getVar('version');
. . .etc
thanks for the reply camfindlay, sorry i should have framed my question properly. I have got the logic sorted. But i am struggling to understand where should i add this code to if i want this logic to work at a global leel.
I would like to get the process working on every controller available. I have already tried it on one of the test controllers init() function and it works fine. Not sure if this is the right place tough
so I need to add this at a certain place in the control flow of the request that gets applied to any controller available.
Do you mean applied to every controller or do you mean every action inside a controller?
The action is what is rendered to a view, unless you perhaps set the variable in the ini() as a class variable like $this->template and them later in your actions use the variable to set the $this->renderWith().
Might be good to get more context around what you are doing. Can you post an example of your controller class? Use http://sspaste.com/ if it is a long example.
Basically i am trying to do the split testing working for my site. the issue is there are various page types in my site that are not listed in CMS so i cannot create a version of these un-listed pages. Lets say these page are called UnlistedA, UnlistedB and UnlistedC
These unlisted page types have actions within. So the idea was irrespective of the pagetype and action within the user is accessing if the URL has ?version=1 or 2 or 3 ....i have to render the data with that version of the template.
I did not want to repeat the checking of version code in every Controller. So was looking for a place so that it gets applied to every controller and every action within the controller.