0

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);      
    $view->setLayout('add');
    $view->add();
}

but I receive JRequest Error in Joomla 4.

2

1 Answer 1

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

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