Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

OOP scares me... (header help)

Hi, I just downloaded Vanilla for use in a small forum, expecting some impressive PHP and MySQL work, but also expecting to be able to work on it just the same. Instead, I see a bunch of object-oriented programming functions that just aren't covered in my basic PHP book. If I want to add some google page tracking to my site, which file could I modify to add it to all the site headers (or just the main ones). I'd really appreciate the help...

Comments

  • Options
    vanilla/appg/init_vanilla.php is a good place to start to see how Vanilla starts up the Core. The headers are set in vanilla/appg/headers.php but you shouldn't manipulate this file directly as it would break your upgrade path. The best place to get started is the Development Documentation.

    Delegation is something you will come to love once you get a grasp of OOP. :)
  • Options
    Okay, why would altering the header file break my upgrade path? I know javascript, so I know not to override the previously called scripts, but I don't know how adding something could break something totally different. Thanks for the help, but I want to know more.
  • Options
    edited April 2008
    When an upgrade to Vanilla is released, unless you use some advanced unix command line tools, all of the files that exist on your installation will be updated regardless of whether they were changed. So any upgrade to Vanilla will overwrite changes you make to "core files". Core files are all the files required for Vanilla to run out-of-the-box.

    And as for this: "but I don't know how adding something could break something totally different", this is the nature of computers, small changes can and will change/break something completely unrelated ;)
  • Options
    So then I can change the header file, but it will be overwritten when I update the software. Unless Vanilla updates constantly, I think I'll change it anyway and make sure to back up my special header file before I update the forum. Thanks for the help!
  • Options
    Sorry to post again, but I looked at the header file and didn't find what I was looking for. I need to know where vanilla stashes the head section of the html code for each page, so I can add some of my own code. I probably should've been more clear...
  • Options
    So you want to add an html header like the lussumo banner on this site?
  • Options
    That's the source code for a banner extension. you would copy that into a text file called default.php, edit the html banner portion of it to meet your requirements (and probably edit the info at the top of the file to better match your banner), and then upload it in its own folder inside the /path/to/vanilla/extensions/ folder. Then enable it via the settings => extensions page in vanilla.

    Doing it this way is the preferred way, as it requires no core file hacking, and will remain enabled after an update.
This discussion has been closed.