Template Variables - mobile or desktop

For support and discussion related to templates, themes, and imagesets in phpBB 3.2.
Post Reply
kaerol
Registered User
Posts: 7
Joined: Sat Feb 20, 2016 3:48 pm

Template Variables - mobile or desktop

Post by kaerol » Wed Jan 03, 2018 9:38 pm

Hi!

here
https://forums.thetopfew.com/viewtopic.php?t=739
https://wiki.phpbb.com/Category:Template_Variables

are some variable which can be used in html template in this way:

<!-- IF S_USER_LOGGED_IN -->
<!-- ENDIF -->

I'm looking for variable which define if forum is open on mobile (or desktop).

I didn't find on provided sites.

User avatar
david63
Jr. Extension Validator
Posts: 14900
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Template Variables - mobile or desktop

Post by david63 » Wed Jan 03, 2018 9:59 pm

As far as I am aware there is no core template variable to indicate whether you are using a mobile device or a desktop computer - this is all handled with .js and .css files.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
Lumpy Burgertushie
Registered User
Posts: 65185
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Template Variables - mobile or desktop

Post by Lumpy Burgertushie » Thu Jan 04, 2018 12:49 am

please explain what you want for the final outcome of what you are trying to do.
why do you want to be able to know this?
what are you going to do with that information if and when you get it?

robert
I am available for custom work on a donation basis. Please send me a PM with your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

OK, so what's the speed of dark?

User avatar
Christian 2.0
Former Team Member
Posts: 4445
Joined: Wed Nov 04, 2009 11:16 pm
Location: UK
Name: Christian
Contact:

Re: Template Variables - mobile or desktop

Post by Christian 2.0 » Thu Jan 04, 2018 10:05 pm

Depending on what you're trying to achieve, displaying content to users dependant on their device can easily be achieved with CSS selectors.

By default prosilver includes the following:

Code: Select all

<div class="responsive-show" style="display: none;">This will be hidden on desktop but show on mobile</div>

<div class="responsive-hide">This will be shown on desktop but hidden on mobile</div>
If you're looking to use either of these in content, you could incorporate them into custom BBCodes :)

User avatar
Hanakin
Infrastructure Team Member
Infrastructure Team Member
Posts: 736
Joined: Wed Dec 30, 2009 8:14 am
Name: Michael Miday
Contact:

Re: Template Variables - mobile or desktop

Post by Hanakin » Sat Jan 06, 2018 1:12 am

i would, however, recommend using CSS media queries instead of those classes as those are problematic seeing as how the randomly behave according to some nasty JS code fooery

kaerol
Registered User
Posts: 7
Joined: Sat Feb 20, 2016 3:48 pm

Re: Template Variables - mobile or desktop

Post by kaerol » Wed Jan 24, 2018 9:35 pm

Sorry for long - silence.

Using css in not so good because it's just hide some code.
But I want to not to render it when mobile.

I have some menu item that open iframe - and its look very bad on mobile so I want to not display this menu item.

Thanks!

User avatar
Hanakin
Infrastructure Team Member
Infrastructure Team Member
Posts: 736
Joined: Wed Dec 30, 2009 8:14 am
Name: Michael Miday
Contact:

Re: Template Variables - mobile or desktop

Post by Hanakin » Thu Jan 25, 2018 11:33 am

then js is how you would need to do this. you can try loading it on the page via an ajax call depending on if there are now template variables in it. if then you will have to rework the desktop version with js dom manipulation.

User avatar
Lumpy Burgertushie
Registered User
Posts: 65185
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Template Variables - mobile or desktop

Post by Lumpy Burgertushie » Thu Jan 25, 2018 7:51 pm

kaerol wrote: ↑
Wed Jan 24, 2018 9:35 pm
Sorry for long - silence.

Using css in not so good because it's just hide some code.
But I want to not to render it when mobile.

I have some menu item that open iframe - and its look very bad on mobile so I want to not display this menu item.

Thanks!
so what is wrong with hiding the code for the menu item? if the particular menu item is hidden when the screen gets smaller then nobody can click on it and therefore the iframe that your menu item produces will never be shown on the smaller device.
maybe I missed something.


robert
I am available for custom work on a donation basis. Please send me a PM with your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

OK, so what's the speed of dark?

kaerol
Registered User
Posts: 7
Joined: Sat Feb 20, 2016 3:48 pm

Re: Template Variables - mobile or desktop

Post by kaerol » Wed Jan 31, 2018 7:23 pm

Maybe it's old school, It's waste of bandwidth for items which won't show.

And sometimes its can be show by others just by modify css with some developers tools.

In this particular problem maybe solution with js/css is good enough.

But sometimes its good to see the big picture

User avatar
Lumpy Burgertushie
Registered User
Posts: 65185
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Template Variables - mobile or desktop

Post by Lumpy Burgertushie » Wed Jan 31, 2018 8:10 pm

either way you are not saving any bandwidth or disk space. the code has to be somewhere for either show or don't show.
It seems that trying to do it the way describe will actually double up code and therefore space/bandwidth etc.


robert
I am available for custom work on a donation basis. Please send me a PM with your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

OK, so what's the speed of dark?

kaerol
Registered User
Posts: 7
Joined: Sat Feb 20, 2016 3:48 pm

Re: Template Variables - mobile or desktop

Post by kaerol » Wed Jan 31, 2018 8:24 pm

If in template is one of these:

<!-- IF U_ACP --> ADMIN <!-- ENDIF -->
<!-- IF S_USER_LOGGED_IN --> LOGGED <!-- ENDIF -->

then elements ADMIN, LOGGED are cut from html when user don't have permissions.
So I looked for something like above, without success.

But I used the solution proposed by Christian 2.0 and its good for my needs.

User avatar
Hanakin
Infrastructure Team Member
Infrastructure Team Member
Posts: 736
Joined: Wed Dec 30, 2009 8:14 am
Name: Michael Miday
Contact:

Re: Template Variables - mobile or desktop

Post by Hanakin » Thu Feb 01, 2018 12:15 pm

It’s not a waste of bandwidth if it’s in the html as that’s 100% cached vs if you use js to manipulate the dom after the fact it’s not! Also html 2.0 makes all your concerns obsolete with multithreading meaning I can load more than one css js img file at the same time as apposed to now where it’s queued

Post Reply

Return to “[3.2.x] Styles Support & Discussion”

Who is online

Users browsing this forum: plopbellie and 7 guests