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.

Trying to understand Views, Controllers - example needed, head hurts!

Hi all and great job to all who developed this lovely forum. I have some recreational html and CSS experience but am confused, despite reading, about how views and controllers etc work.

Could someone summarise what happens when I click on 'Activity' for example. I'll put my limited thoughts so you can correct me:
Click on the Activity link > sends /activity to ?default.php (where is this?) controller?? > some magic happens > data is extracted from the database using a controller and a particular method > presented via a view for that method > default.master view is used to render this.

Basically what I would like to do is have a home page that is the same as the recent discussions view, but with html - in my case I'd like to be able to insert some custom HTML at the beginning of the content pane prior to the the rest of the discussions, and call the search box to the beginning of the content page rather than the side panel.

I'm trying to analyse the different views to make sense of the documentation but I'm too much of a Newb to find the files or understand it fully.
If I can work out how to call an alternate view I can copy the files for the recent discussion view html etc, rename and modify the html for the view.

So any kind of summary as to how the above happens (and where the files are) would be invaluable as I'm keen to learn myself once I'm looking in the right direction.

I could use the plugin for new pages but would rather understand how Garden/Vanilla works for this.
Many thanks in advance.


  • 422422 Developer MVP

    check out the wiki

    There was an error rendering this rich post.

  • I've read the wiki but some of the explanations are a little abstract. I've tried to read the explanations then find an example from the code to work through (in this case I'm trying to follow where 'Activity' leads to and how that generates the content so as to understand things more fully.
    Unfortunately I'm not getting anywhere!

  • Just to confirm I read: but I couldn't follow through back to my original excercise of following what happened when the 'Acitivity' menu item was selected.

  • x00x00 MVP
    edited February 2013

    Anything like Activity has a controller so it will be the ActivityController. As applications are working in parallel it could be in one or another. In this case it is in the dashboard application.

    The method is usually the next of the url so if the url is /activity/comment it will go to the Comment method in the ActivityController. If there is no obvious method, it will most like go the the Index method.

    Controllers ultimately control what is output, views are there for convince. Controller are supposed handle the bulk of the logic, to keep the view as clean as possible.

    Note the way to extend functionality safely is by hooking events in plugins, there are events in various places in controllers, models and views. There is more information on plugins in the documentation.

    If you are trying to make an application than studying the other application will help.

    grep is your friend.

  • That's great thanks, now I can follow / study things and try to work things out that way. Stydying what's there at the moment is a good way to understand things further.

Sign In or Register to comment.