Please upgrade here. These earlier versions are no longer being updated and have security issues.

add different .tpl for pages

This discussion is related to the Custom Pages addon.
jackmaessenjackmaessen ✭✭✭
edited February 2014 in Vanilla 2.0 - 2.8

Using 2.0.18.10 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:
http://vanillaforums.org/discussion/comment/167921/#Comment_167921
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
      decho($PageName);
      switch($PageName) {
        case 'scripts':
        case 'develop':
          // You will probably need to modify this path
          $Sender->AddCssFile('themes/VanillaBootstrap/design/custom_scripts.css');
      //$this->MasterView = 'themes/VanillaBootstrap/views/scripts.master.tpl'; // trying something like this 
          break;
        default:
          // Don't do anything to other pages

          break;
      }  
    }
  }
        ///////////////////////////////////////////////////////////////

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

Comments

  • hgtonighthgtonight ∞ · New Moderator

    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.

    Shadowdare
Sign In or Register to comment.