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.
Options

Seperate headers

Hi

Is it possible to deliver seperate headers to different sections within Vanilla, for example, for any template under the /entry/ folder I want to use a seperate default_master.tpl - is this doable?

Comments

  • Options

    I would think so.

    $Sender->MasterView = 'default';

    create a file called 'chrisgwynne.master.php

    $Sender->MasterView = 'chrisgwynne'

    change the master view to what you want based on the url.

    however if you are looking at just changing banner, it might be easier just loading a new css based on url.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    For my purpose I need an entire different view that wouldn't be alterable by CSS alone.

    I'm new to the Vanilla framework however, where would I need to alter/add this $Sender->MasterView details.

  • Options
    hgtonighthgtonight ∞ · New Moderator

    I would go with theme hooks on the controller's magic render before method.

    E.g.

    public function DiscussionController_Render_Before($Sender) {
      $Sender->MasterView = 'chrisgwynne';
    }
    

    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.

  • Options
    peregrineperegrine MVP
    edited June 2013

    you might try

    if you are looking at entry controller. e.g.

    public function Base_Render_Before($Sender) {
            if (($Sender->MasterView == 'default' || $Sender->MasterView == '') && C('Themes.EmbedFriendly.SingleColumn'))
                $Sender->AddCSSFile('singlecolumn.css');
                $Sender->MasterView = 'error';
        }
    
    
    or
    
    public function EntryController_Render_Before($Sender) {
            if (($Sender->MasterView == 'default' || $Sender->MasterView == '') && C('Themes.EmbedFriendly.SingleColumn'))
                $Sender->AddCSSFile('singlecolumn.css');
                $Sender->MasterView = 'error';
        }
    
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    there are numerous discussions explaing how to use themehooks, or you could make a plugin - similar to admin theme switcher or mobile theme switcher for good and bad clues.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    Okay so I added

    public function EntryController_Render_Before($Sender) {
    $Sender->MasterView = 'entry';
    }

    to a custom hook file in the theme folder, i have a entry.master.tpl file set up in the correct folder. It generates an error on the server.

  • Options
    peregrineperegrine MVP
    edited June 2013

    where did you put entry.master.tpl it should be in the views folder of your theme.

    i tried .tpl files and php files and they both work in themehooks, the example above works for me if I have error.master.php in my theme folder.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    I'm using the default theme, and i've placed entry.master.tpl simply in /applications/dashboard/views/ - where the default.master.tpl resides.

  • Options
    peregrineperegrine MVP
    edited June 2013

    I'm using the default theme, and i've placed entry.master.tpl simply in /applications/dashboard/views/ - where the default.master.tpl resides.

    it's not a good idea to do that.

    create your own theme in the themes folder.

    then add the views and changes there.

    read up on how to create a theme - one of the announcements.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    @peregrine said:
    read up on how to create a theme - one of the announcements.

    Will do, thank you. I've got this to work now, many many thanks. But i'll read up on own theme creation.

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    I wish people would not edit the default theme.... There should be some kind of warning in the documentation about doing this... At the very least encourage people to make their own or use a downloaded one Even if it's a copy of the default

Sign In or Register to comment.