Jump to content

Is their template logic to output HTML based on display size?


Recommended Posts

I couldn't find anything in the docs, but I want to apply some different code in template logic for desktops, tablets and phones.

We can use media queries in CSS to make styling relevant for certain device screen widths and we have ipsResponsive_showPhone etc.

However, is there a utility available to do the same for HTML in IPS' template logic, perhaps a PHP expression or something?

Something like:

{{ is small-device/phone? }}
this code
{{elseif is medium-device/tablet? }}
this code
{{else}}
use this for everything else
{{endif}}

Many thanks!

Link to comment
Share on other sites

No, there is no equivalent you can use in IF checks. What IPS does is include the multiple HTML blocks in the page output and then show/hide them with the CSS classes:

 

With outputting all of them, it won't matter even if the size changes. For example, the browser's window can be resized on desktop, or you can use the web developer tools to emulate a phone/table.

Edited by teraßyte
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...