Allow some pages to be full screen IE no side bar

Is there a way when rendering a page that you can specify no side bar on the code for that page? Or is it just as easy to do in CSS?

Comments

  • If its impossible to remove this code, the best way it's use CSS to hide this bar. EG:

    .nameClass {display:none !important;}

    MrCaspan
  • Yep i did finally do it with CSS that gets loaded by this page

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    It can easily be done in css. The main css elements in Vanilla are

    .Header

    .Content | .Panel

    .Footer


    So hiding .Panel alone would still leave some room on the right. The .Content should be expanded to 100%

    .Panel { display: none; }
    .MainContent.Content { width: 100% }
    


    Loading html and not displaying it is somewhat unsatisfying. If you are working on a custom theme, you can use a themehooks file to further customize Vanillas behaviour. This themehooks file is something like a theme-specific plugin.

    Internally Vanilla is working with "assets" which are called just like the css classes above. The Panel asset is just one array element of the individual controllers, like the DiscussionsController (which renders the recent disussions), the DiscussionController (that renders a single discussion) and so on. Therefore, if you hook into Vanilla before a page gets rendered, you can unset the Panel from the Assets array and it will not be processes. You would certainly have to additionally do the CSS changes.


       public function discussionsController_render_before($sender) {
           unset($sender->Assets['Panel']);
        }
    


  • It's actually for your calendar plugin. So in the month.php can I just tell it not to load the side menu?

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    The url to the month view is /vanilla/eventcalendar/month. That is

    Controller: VanillaController

    Request Method: eventcalendar

    Request Arguments: month


    The VanillaController extends the base controller which has the request method and arguments as properties. Therefore you can do it like that:

       public function vanillaController_render_before($sender) {
           if (
               $sender->RequestMethod == 'eventcalendar' &&
               $sender->RequestArgs[0] == 'month' ?? ''
           ) {
               unset($sender->Assets['Panel']);
           }
       }
    



  • Of if you want the stuff there but hidden, add .NoPanel classname to the body tag in your default template or via JS when page loads

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    No need to add something. The body element gets automatically a #vanilla_vanilla_eventcalendar id so that the css above prefixed with #vanilla_vanilla_eventcalendar will do the trick


    MrCaspan
  • I mean, a set of CSS rules for .NoPanel is shipped by the new Vanilla Forums boilerplate template.

Sign In or Register to comment.