title: PHP variable change based on device width
body: <p>What I want to do is to make my site get the current width of the window that the visitor has. Then I want to have two different options. Something like this:</p>
  <pre><code>&lt;script&gt;
  if (screen.width &lt; 768) {
  &lt;?php $a = 1; ?&gt;
  } else {
  &lt;?php $a = 2; ?&gt;
  }
  &lt;/script&gt;
  </code></pre>
  <p>What I'm trying to do is that my php variable should change based on device width.</p>
  <p>Which way is the easiest way to do this? I can't write or understand a single row of AJAX so if that's the only way I would be very satisfied with some kind of guide to make this as easy as possible.</p>
  <p>And to make it with CSS is not the right way. So please, don't tell me something that has to got anything to do with CSS.</p>
  <p>Edit:</p>
  <p>I'm not sure if you guys understand what I really want to get out of this code.</p>
  <p>So I will write it more specific.</p>
  <p>I have a site which has an image-slider on top that shows the 2 latest news. Right under this I have a query of posts that are set to offset 2, because I don't want to query the same news that I have in my slider.</p>
  <p>So my code is something like this:</p>
  <pre><code>&lt;?php 
  $offset = 2;
  $showposts = 10; 
  ?&gt;
      
      &lt;?php query_posts(array('offset' =&gt; $offset, 'showposts' =&gt; $showposts,'cat' =&gt; '8')); ?&gt;
  </code></pre>
  <p>And I can't make two different queries because I have ad-scripts that can't be loaded more than 1 time, because then they will not show at all. So it all need to be done in one query, and that's why it has to be changed based on device width.</p>
  <p>Now I forgot to tell that on my version for width &lt; 768 I make my slider disappear and therefore I want to have the offset to 0 instead of 2.</p>
  <p>I hope this makes more sense...</p>