View function pulling wrong files

New to Elgg, but have to say I'm impressed as hell. I'm designing a new site, previously have been using vBulletin and modding the hell out of it, but I like what Elgg has to offer and the mod potential.

Currently I'm working on an extension of the Groups plugin (yes, ambitious for a first mod), going well, learning a lot about the inner workings of Elgg.

Problem. The plugin is working well so far but when I go back to Groups, the views seem to pull the files from my plugin rather than the Groups plugin. I've checked my code, set the context, but still happens.

Now the view files in my plugin use the same directory/filename structure as Groups and I've found that if I rename my files, the Groups goes back to working properly. Is this due to the replacement nature of views? In other words since I am extending Groups and my files are the same name, that Elgg is chosing my files instead?

Not really an issue if it is, as I said, renaming my files "fixes" it, I just want to be sure I fully understand what is happening and that I'm not missing something obvious.

  • The groups plugin is probably the scariest of all the plugins distributed with Elgg so you are being brave. It is due for a rewrite in one of the next two releases.

    Elgg mostly uses convention over configuration for its view system. If you create a plugin that has a view with exactly the same name, Elgg will automatically pick it up. This makes it very easy to modify and extend Elgg. If you wanted to change the header on every page, all you need to do is determine the view, override it in a plugin, and your site now has a new header. 

    If I'm not overriding a view, I namespace all my views with the name of my plugin: /mod/<plugin name>/views/default/<plugin name>/blahblah.php

    I've written a plugin called Elgg developer tools that has some handy options for working with views. You might want to try that out to get a better feel for what is happening in the Elgg internals. It'll add a div around each view so you can use Firebug to find the div that creates the HTML that you are interested in. The plugin also tells you what file is being used for what view - including view extensions.

     

  • Ok that's what I thought from reading the docs and tutorials. Just wanted to be sure.

    I've done as you suggested and renamed my view files with my pluging name appended.

    The Groups isn't too bad, I'm just taking one section at a time. Right now I've got it creating and editing my new groups and handling discussions. Work on files and photos next :) It's been a great way to learn the code and system honestly.

    The tools you mention I've seen, I'll get that installed and check it out.