I use this code on my component in Joomla 3:

function add() {
    if(JRequest::checkToken( 'get' )) {
        JRequest::checkToken( 'get' ) or die( 'Invalid Token' );
    } else {
        JRequest::checkToken() or die( 'Invalid Token' );
    JRequest::setVar('hidemainmenu', 1);        
    $model = $this->getModel('albums');
    $view = $this->getView('albums', 'html');               
    $view->setModel($model, true);      

but I receive JRequest Error in Joomla 4.


1 Answer 1


Use this for JRequest error

<?php if( Joomla\CMS\Factory::getApplication()->getInput()->get('view') != 'article' ): ?>

Inside a module you can simplify it to this:

<?php if( $app->getInput()->get('view') != 'article' ): ?>

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.