Please disregard the 'View article...' shown at the bottom of many posts as this is the result of restoring old forum posts from a backup.

Exp 2.3.0 adding viewport also for the non-responsive sites

This is fixed if we "hack" the file expTheme.php in framework/core/subsystems/
the line 264 is like this originally:
$viewport = 'width=device-width, initial-scale=1.0, user-scalable=yes';

This comes as a default if nothing has been changed.

Most of the non-responsive sites are around 1024px wide or if they are narrower this still works, so I put the default line like this:

$viewport = 'width=1024';

Now my non-responsive sites looks like before in the previous Exp from the year 2011, and the responsive layouts can be planned with better time and not with a rush when upgrading the Exp version.

After this it is of course possible to still edit the viewport settings in header info as described here in the docs:
http://docs.exponentcms.org/docs/header-info
(you can also "spy" on the Exp own bootstrap based theme how to use these settings in the header)

Of course the hack should not be needed but this should be so in the Exp that also the non-responsive sites would work and all the responsive sites can make their special settings since other way round is difficult.


View article...

Comments

  • Hi,
    there is a problem that Exp 2.3.0 is adding a tag of viewport also for the non-responsive sites and when you are viewing the site in a mobile phone, part of it is not visible.

    Exp adds this as default:
    < meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" >

    The link below explains a non-responsive site should have only like in this way (depending the actual width of your site):
    < meta name="viewport" content="width=1024" >

    More on this on:
    http://webdesignerwall.com/tutorials/viewport-meta-tag-for-non-responsive-design

    I can CHANGE the settings of the viewport in the of the theme file "index.php" but how to REMOVE totally the "initial-scale=1.0". We should not set it to anything.


    View article...
  • To change/remove the 'viewport' line in the 'expTheme::head' config, see this doc page http://docs.exponentcms.org/docs/header-info

    You can either specifically set the 'viewport' or remove it. See the last two paragraphs and the example at the bottom of the page. Viewport has been a part of Exponent since at least v2.2.0.


    View article...
  • Ok,
    I can get the viewport line TOTALLY REMOVED by writing in the meta array this line:

    "meta"=>array(
    "viewport"=>false,
    ),

    But what about if I want viewport but only to achieve this line:
    < meta name="viewport" content="width=1024" >

    If I add this line
    "viewport"=>array("width"=>"1024",
    ),

    I get this line in the page source code
    < meta name="viewport" content="width=1024, initial-scale=1.0, user-scalable=yes" >

    But I do not want initial scale set at all, neither user-scalable, only the width that the non-responsive site is zoomed out properly in the mobile phones and the user is able to scale it by herself.

    So, this would work if the expTheme.php wouldn't set initial scale and user-scalable as default.


    View article...
  • After doing some more research, it appears the spec/approach has changed somewhat since our initial implementation. I'll change the code to ship out with v2.3.0patch2 next week so there is NO initial-scale default. However, we'll still set our width to device-width (vs default of 980) and set user-scalable to yes (which should be the default)


    View article...
Sign In or Register to comment.