Different Snippet per Breakpoint

Hi there,
I’m working on a project where a page will have huge difference between mobile and desktop layout, to the extreme where just SASS tricks with breakpoints wont do the job.

My idea was to make 2 different snippets for the same page, for example myPage-mobile.php and myPage-desktop.php, which both will echo the same content, but will display it in completely different way. The idea is that in the parent myPage.php I could write something like:

if (device()->isMobile()) {
<?php echo snippet for mobile

if (device()->isDesktop()) {
<?php echo snippet for desktop

… using something like Kirby Device.

Is there an other way to approach this, or do you have any tips?

Checking the user agent is generally not considered good practice, but you probably know that yourself. The question is if there is really no other way and why the layout has to differ that much that it can’t be solved with CSS.

1 Like

I think the only way will be to have a conversation with the designer and make her understand what she’s asking of actually means. I guess you know how people think code is magic and can do anything you can possibly imagine…