1

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 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.

Any help is much appreciated. Thank you.

1

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, privacy policy and cookie policy

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