Not Solved get screen width using php in template
#1
Not Solved
This user has been denied support. This user has been denied support.
hello master of mybb and spacial php masters..

i am already use Template Conditionals mybb plugin and try to make 
<if content usign screen width but its'nt work properly.
<if window.screen.width <= 680 then> You are using mobile device</if>

 <if window.screen.width >= 680 then> You are using computer</if>

but itsn't work please fix this issue.
Reply
#2
Not Solved
Because that's javascript, not PHP. Use javascript to hide and show a div, PHP conditionals aren't what you want here.
MyReactions - All Plugins

Can you still feel the butterflies?

Free never tasted like pudding.
Reply
#3
Not Solved
This user has been denied support. This user has been denied support.
yes i can make js screen width resolution but have one problem js only hide display on screen not completely remove all coding around with this script.
and page will be going long loading...
i want make full optimse template with responsive layout using php and remove extra coding completely in mobile resolution to make faster page load.

if its n't available in PHP conditionals so please give me php coding for globle.php and for other .php file to geting screen width using $mybb->['screen.with'] vreb.

i now this vreb not work i want same php coding to get work this vreb and geting sreen width then i will easily do this.

like
<if $mybb->['screen.with'] <= 680 then> You are using mobile device</if>

 <if $mybb->['screen.with'] >= 680 then> You are using computer</if>

like

<if 480 <= 680 then> You are using mobile device</if>

 <if 1020 >= 680 then> You are using computer</if>
Reply
#4
Not Solved
With my theme variables premium plugin, there is code to determine if a user is browsing on a mobile device. You can parse separate content for mobile devices and desktop devices. For more info, you can see my services thread in my signature.
Reply
#5
Not Solved
You're not going to get reliable screen size metrics in PHP - PHP is executed server side, screen width is client side. You're using the wrong technology to achieve this, what you really want are CSS media queries.
MyReactions - All Plugins

Can you still feel the butterflies?

Free never tasted like pudding.
Reply
#6
Not Solved
This user has been denied support. This user has been denied support.
I already use CSS media method.

But really want most optimization template just need screen width then I will do.

And how to use theme variables plugin?
Reply
#7
Not Solved
So you're trying to optimise the site by removing a few lines of HTML for certain screen sizes? My advice would be it's really not worth it, there will be absolutely no benefit whatsoever on the scale you're doing it, you'll be saving literally a few bytes of data. If you're that worried about it, put your site behind Cloudflare so it will minify the HTML for you.
MyReactions - All Plugins

Can you still feel the butterflies?

Free never tasted like pudding.
Reply
#8
Not Solved
Look here => http://detectmobilebrowsers.com/ Wink
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)