2

My component is named "com_xsomething" (to make it distinct).

My main view is called "Something".

I want to name my view "Something" rather than "xSomething".

How do I write the main controller's display() function to display the "Something" View and not have Joomla look for "xSomething"?

I tried the below code but it failed miserably:

class xSomethingController extends JControllerLegacy{
    function display(){
        $viewsomething = $this->getView('Something');
        $viewsomething->display();
    }
}

Error:

500 View not found [name, type, prefix]: something, , xsomethingView

I can't name my view "xSomething" because it doesn't make sense in the context my component.

1 Answer 1

2

Answered my own question upon reviewing the API documentation and playing around with the code.

I was able to display a different view by specifying the view type and view class prefixes:

class xSomethingController extends JControllerLegacy{
    function display(){
        $viewsomething = $this->getView('Something', 'html', 'xSomethingView');
        $viewsomething->display();
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.