0

I need to change template if screen resolution is bigger than 1024*768 pixel. I try Meta Template 1.8. It has many tools to the template change, but it doesn't have resolution tool. I know that I need to do without Joomla: query the resolution in javascript, then set a new location with a GET param.
But I don't know how can I do this in Joomla..

Please give me any advice. Sorry for my bad english..

user594297
  • 93
  • 2
  • 13

3 Answers3

0

I solved my problem: To the default template's index.php I add this rows at the top of the file:

<? if(!isset($_GET['res']) ) : ?>
<script language="javascript">
window.location.href = "index.php?res=" + screen.width;
</script> 
<? endif; ?>

And I add this row to the Meta Template / Rules / Advenced Php:

if($_GET['res']>1024)
return "mytemplatename";

I work with the GET array, so my url will be a little mess.

How can I do this with the POST array?

user594297
  • 93
  • 2
  • 13
0

Use JRequest::getInt('res') instead of $_GET['res'].

JRequest::getInt('res') will look into $_GET & $_POST

Have a look in JRequest spec

fornve
  • 1
0

You should perhaps look at keeping a single template and then using something like http://stuffandnonsense.co.uk/projects/320andup/ to handle resizing based on the screen size.

Jeepstone
  • 2,591
  • 5
  • 22
  • 38