Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

add different .tpl for pages

jackmaessenjackmaessen ✭✭✭
edited February 2014 in Vanilla 2.0 - 2.8

Using with VanillaBootstrap theme
I am using a switch case for adding specific .css file for some custom pages. @hgtonight made this for me.
This works perfectly but the only problem is the sidebar, which i want to remove completely. So i was searching and i found this topic:
But i don't know how to handle with this.
What i actually want is for those custom pages load a different .tpl
This is part of my code in calss.bootstrapthemehooks.php:

///////////// load different .css for specific pages ///////////
        public function PluginController_Render_Before($Sender) {
    // Only execute on the Page method of the plugin controller
    if($Sender->RequestMethod == 'page') {
      // Only add custom.css for certain pages
      $PageName = GetValue(0, $Sender->RequestArgs, 'default');
      // put any page names you want to load different CSS files in this switch case statement
      switch($PageName) {
        case 'scripts':
        case 'develop':
          // You will probably need to modify this path
      //$this->MasterView = 'themes/VanillaBootstrap/views/scripts.master.tpl'; // trying something like this 
          // Don't do anything to other pages


Can someone help me with that to load for these pages a different .tpl?


  • Options
    hgtonighthgtonight ∞ · New MVP

    The tpl file is chosen via the controllers MasterView member.

    Explicitly setting it will override the defaults. You would use something like $Sender->MasterView = 'scripts';

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

Sign In or Register to comment.