Jump to content
  • 0

How do i select bootstrap as theme from URL?


arvinraj

Question


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  2
  • Reputation:   0
  • Joined:  08/06/12
  • Last Seen:  

Hey guys,

I have FluxCP installed with the default and bootstrap theme. For ordinary web viewing, I'd like default theme to be selected.

However, for my patcher file, I'd like users to view the site from the bootstrap theme due to the window size limitation.

Is there a way i can direct the URL to select the bootstrap theme from within the patcher?

 

E.G

Edited by arvinraj
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Forum Manager
  • Topic Count:  282
  • Topics Per Day:  0.06
  • Content Count:  3122
  • Reputation:   1614
  • Joined:  03/26/12
  • Last Seen:  

Why are your players browsing your website through your patcher?

 

On the flip-side, it'd be a nice feature to have.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.01
  • Content Count:  193
  • Reputation:   41
  • Joined:  07/21/16
  • Last Seen:  

Any ideas if that would be do-able on patcher? It really is a good idea.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  2
  • Reputation:   0
  • Joined:  08/06/12
  • Last Seen:  

bump

Edited by arvinraj
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  2
  • Reputation:   0
  • Joined:  08/22/16
  • Last Seen:  

Using JavaScript you can get the window dimensions and then render the theme via php based on the dimensions of the window. So if the patcher is viewing the website in a 400px x 400px screen you can do something like the following.

 

set this near the top of the index.php

if(!isset($_GET('r')) {
  echo "<script language=\"JavaScript\">
    <!--
    document.location=\"$PHP_SELF?r=1&width=\"+screen.width+\"&Height=\"+screen.height;
    //-->
  </script>";
}
else {
  if(isset($_GET['width']) && isset($_GET['Height'])) {
    $width = $_GET['width'];
    $height = $_GET['Height'];
  }
}

then set this down where you set the session info in the index.php

 if($width == 400 && $height == 400) {
    Flux::config('ThemeName', array('bootstrap'));
 }
Again, this assumes the patcher window is 400px x 400 px. Also note my php is a little rusty, so this may not be 100% but it should put you on the right track
Edited by Cynical89
Link to comment
Share on other sites

×
×
  • Create New...