Thumb output

Post Reply
jorah
Posts: 9
Joined: Fri Jun 30, 2017 6:54 am

Thumb output

Post 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.
admin
Site Admin
Posts: 37202
Joined: Wed Sep 10, 2008 11:43 am

Re: Thumb output

Post 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
Don't forget to run script update
jorah
Posts: 9
Joined: Fri Jun 30, 2017 6:54 am

Re: Thumb output

Post 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 ?
admin
Site Admin
Posts: 37202
Joined: Wed Sep 10, 2008 11:43 am

Re: Thumb output

Post by admin »

No, most likely you don't understand the workflow of a webpage
Don't forget to run script update
Post Reply