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.

Create your own custom page + with theme tpl files

Hi, I wonder witch is the best way to do this:
I playing around with vanilla a little bit and see what I can do with it and so on. And I came up with a idea.
I have a install with vanilla on the root. And i want to have a custom home page. I now that I can set the home page link in vanilla dashboard. But my really question is if I create a new folder that is called like "Main" in the root. Add a page that is called, "home.php" And I want to use a custom template, I know i can create a template call like "home.master.tpl" In my theme folder. But I wonder how do I connect my "home.master.tpl" to "home.php" ?

I hope I was clear what I want do to. If not just ask what you don't understand and I will try to explain.

(I don't want to you use the plugin custom pages) And as I say, I'm just playing around and see what is possible to do with vanilla with my experience.

Comments

  • I believe you would set the masterview.

    $Sender->MasterView = 'home';

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

  • At the top of my home.php file then? right?

  • try it, I don't know all the answers.. :).

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

  • @peregrine hehe i will do :) Just want to see if I can fix my other problem first :P

  • peregrineperegrine MVP
    edited November 2012

    @zar3x said:
    peregrine hehe i will do :) Just want to see if I can fix my other problem first :P

    report back if the above works.

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

  • zar3xzar3x
    edited November 2012

    @peregrina. Okey I tested this one and it didn't work.
    This is what I did. Created a new php file in vanilla root called home.php.
    Created a new tpl file in my current theme views folder called home.tpl (did try with home.master.tpl to)
    Pasted in $Sender->MasterView='home' to my home.php file. But when I'm loaded the home.php file i get this error.

    "Creating default object from empty value in \xampp\htdocs\vanilla\home.php on line 1"

  • I don't know. I use my extrapages plugin for things like this.

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

  • @peregrine well I downloaded your plugin, and it works like a charm :) But I wonder if there is some how I can add more then 1 page?

  • x00x00 MVP
    edited November 2012

    Loading home.php, will not load the framework.

    First of all the days where you have physical files like search.php where all the logic and the output template code was included inside, are over. In those day they had a file like that for each interface, and they added the header.php and footer.php. That is just not how code is organised now, it is inefficient. Everything goes through the dispatcher and is routed to the controller, which selects the view.

    It is called MVC
    http://en.wikipedia.org/wiki/Model–view–controller

    Simplest option for you would be custom pages plugin. It uses the pluign controller, but you could use routing if you want to hide this fact.

    grep is your friend.

  • @x00 well I tested the custom pages plguin, and it work greats now after I understood how the routing works. So custom pages It is with some custom template for it. :)

    Tank you all for all the help and suggestions :)

  • aeryaery Gtricks Forum in 2.2 :) ✭✭✭

    Nothing much. Just thank you @x00 @peregrine
    Whenever I am free, I roam around in this community. And I have learned so much from you guys :)

    There was an error rendering this rich post.

    peregrine
  • @aery said:
    Nothing much. Just thank you x00 peregrine
    Whenever I am free, I roam around in this community. And I have learned so much from you guys :)

    I learn alot from all of you. if no one else can solve the problem, generally x00 and Todd help with the sticky issues that appear seemingly irresolute.

    And as far as creativity - no one can beat kasper.

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

  • aeryaery Gtricks Forum in 2.2 :) ✭✭✭

    Challange accepted. Kasper, watch out.

    There was an error rendering this rich post.

  • Related to this, what if I wanted to add a file to my site root directory that served as a portal, when Vanilla resides in a subdirectory? This is the only case I can think of where a file would be the solution. Any thoughts?

Sign In or Register to comment.