Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter
Support for Vanilla Forums Cloud product

In this Discussion

Follow Us


[Documentation] Can I override a plugin's view in a custom theme?

edited April 2012 in Questions

I'm working on a theme, and I'd like to change the functionality of the Tagging plugin. Namely, I'd like to override class.tagmodule.php in my theme.

I know I can override the views in my theme, but what is the practice for overriding plugin modules like this?

Best Answers

  • mcu_hqmcu_hq ✭✭
    Answer ✓

    ZacharyLewis said: Do themes not allow that functionality?

    I don't think they do.

  • x00x00 MVP
    Answer ✓

    I provide this functionality on some of my plugins, especial where I am already overriding core views.

    It is not a standard thing though, But I support it in principle, as it is consistent with application views

    The principle of it is like so

        $PluginFolder = basename(dirname(__FILE__));
        $ThemeFolder = strtolower($PluginFolder);
        $Sender->ControllerName='';
        $Sender->ControllerFolder='';
        $ThemeViewLoc = CombinePaths(array(
            PATH_THEMES, $Sender->Theme,'views', $ThemeFolder
        ));
        if(file_exists($ThemeViewLoc.DS.strtolower($Sender->RequestMethod).'.php')){
            $Sender->ApplicationFolder= '';
            $Sender->ControllerName=$ThemeFolder;
        }else{
            $Sender->ApplicationFolder='plugins/'.$PluginFolder;
        }
    

    I use lower case folders within themes views folder as this is consistent with the current style

    grep is your friend.

    UnderDog

Answers

Sign In or Register to comment.