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

Master file as default.master.php breaks vanilla.

Hello.

I have vanilla installed on my server and am in the process of making my own theme for my website. When I have a "default.master.tpl" file in my theme folder under views folder all is well. I want to use some php in the master file so I changed it to "default.master.php" and it broke my form. Now when I go to the website I get the "something went wrong" page with the big crossed eyed smiley.

I need to use some php code so any help will be appreciated.

I am using Vanilla 2.2 if it changes anything.

Comments

  • Options
    whu606whu606 I'm not a SuperHero; I just like wearing tights... MVP

    @shayr

    Welcome to the community.

    You can't just change the file suffix, although you can use default.master.php files.

    Generally, you can enter php in a tpl file inside tags.

    If you let us know what you are trying to achieve, it may be that there is a pre-existing solution.

  • Options

    Hello.

    First, thanks for the super quick reply. I was trying to add some Js and CSS files to the head part. I was able to do it via theme hooks using $sender->Head->AddCss('/path/to/file') and $Sender->Head->AddScript('path/to/file') using the Base_Render_Before function. It worked, but the problem is I need the files to load at the END of the head part, while the method I used put it the beginning of the part.

    In addition I will want to add some more php custom functionality to the theme master file.

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    As of Vanilla 2.1 , the master template is a tpl based one. You can use any php based theme , try my themes and see.

    If you want to use a tpl based theme, the themehooks file is the place to put your php.

  • Options

    @vrijvlinder How do I use a php based master template then? naming the file default.master.php didn't do the trick. The admin.master.php on the other hand IS a php file for some reason. I will look up your themes any case, if there's something to learn from them then thats a time spent well.

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    No you do not touch the default one in the applications/dashboard /views/default.master.tpl

    You add a custom theme to your forum. Try one of my themes, they are mostly php based.

  • Options
    shayrshayr New
    edited February 2016

    Never mind, just looked at your denim theme and saw the php master file. I will look at it in depth and see what you did there.

    Yes, that is what I did, in accordance with the docs on the website, and then created a theme hook file for adding the css and js files, with the problem of them being added BEFORE the original ones. Also, the question remains, how can I use a default.master.php instead of a tpl file.

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    the question remains, how can I use a default.master.php instead of a tpl file.

    As I explained above, you can use anything you want as far as a custom theme. You do not mess at all with the default.master.tpl from the core files . You only deal with the custom theme.

    You install the theme, that is all. I prefer php based themes so I made several.

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    created a theme hook file for adding the css and js files

    You do not need to do that, the files get picked up when you have them in the correct folders of a theme.
    If you need to add js files or other things, it is recommended to do so via plugins.

    A php based theme does not really use a themehooks file but it could. themehooks files are mostly for tpl based themes. It acts as a plugin.

  • Options

    @vrijvlinder said:
    You do not mess at all with the default.master.tpl from the core files . You only deal with the custom theme.

    Yes, thats what I did. That is, copy the tpl file into my custom theme. I just didn't know how to make it a php style master file until I looked at your Denim theme

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    Yes, I converted the BitterSweet theme from tpl to php based master, if you want to compare the two, download BitterSweet theme and BetterBitter which is the one I made. That way you can see what I did by comparing both themes and it's files.

  • Options

    Just doing it now. These themes are a big help as in the future I will need to use a php style master file. I am now comparing the tpl and php structure of the files. Thanks for the help :)

Sign In or Register to comment.