Page 1 of 1

Thumb output

Posted: Mon Aug 21, 2017 7:39 am
by jorah
Hello, I use div blocks on the main page. Favorites, Best, New, etc.
Blocks are responsive.
When screen width say 1280px and I call thumbs output <thumb num=1-35></thumb>
I have 5 rows and 7 columns and it's OK.
But when screen width 1024px I have last row with empty thumb cells.
Question : How can I send screen width in template to use php to control thumbs amount ?

I tried to use javascript to set screen width in cookie but this scheme doesn't works in the first page load.

Re: Thumb output

Posted: Mon Aug 21, 2017 7:53 am
by admin
You should adjust it in html because

You'll have a problem in 1600 for example , there are a lot of resolution so you'll get a truncated row anyway

Also first of all a page is generated and served to a user and only after then JS that can detect a resolution, not other way around

Re: Thumb output

Posted: Mon Aug 21, 2017 8:06 am
by jorah
But if I create file my.php

<script type="text/javascript">
document.cookie =
"sw=" + screen.width;
</script>

<?php
include('./scj/tube/index.php');
?>

I can detect width before page generation, write? But in same load session I can't read $_COOKIE['sw'] in template.
Second page load works great, then I can use php if with == n px -> output 1-n thumbs

Maybe I can send width in GET parameter ?

Re: Thumb output

Posted: Mon Aug 21, 2017 10:00 am
by admin
No, most likely you don't understand the workflow of a webpage