1

I'm looking for a possible quick fix (temporary) for the follow error. This is on a Joomla 3 site, which I can only seem to assume was migrated from a Joomla 2.5 site which hopefully will be migrated soon. Pending customer agreement.

Fatal error: Declaration of Dynamic_contentController::display($cachable = false) must be compatible with Joomla\CMS\MVC\Controller\BaseController::display($cachable = false, $urlparams = []) in /home/customer/www/clariumfcs.com/public_html/administrator/components/com_dynamic_content/controller.php on line 32

The error is referring to the following piece of code:

/**
 * Method to display a view.
 *
 * @param   boolean         If true, the view output will be cached
 * @param   array           An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
 *
 * @return  JController     This object to support chaining.
 * @since   1.5
 */
public function display($cachable = false)
{
    require_once JPATH_COMPONENT.'/helpers/admin.php';

    DC_AdminHelper::addSubmenu(JRequest::getVar('view'));

    $document = JFactory::getDocument();
    $document->addStylesheet('components/com_dynamic_content/assets/admin.css');
    $document->addScript('components/com_dynamic_content/assets/jquery-1.7.2.js');
    $document->addScript('components/com_dynamic_content/assets/admin.js');

    JRequest::setVar('view', JRequest::getCmd('view', 'Dynamic_contents'));
    
    parent::display($cachable);
}

I've completed the initial google search for the error but come up empty and this isn't really something I'm familiar with. I'm guessing function an additional parameter? Would I be on the correct path with that? I'm stumped. If there is an easy edit for this function I'd appreciate it so I can access the component temporarily.

1 Answer 1

1

I think that you need to replace the line

public function display($cachable = false)

with this line

public function display($cachable = false, $urlparams = array())

which defines the display method in libraries/src/MVC/Controller/BaseController.php

Essentially two parameters are available in the default function where as in your function only one is provided and the message is saying you need provide the second one, in this case and array called $urlparams

1
  • Brilliant, thank you. That has allowed us to access the details in the background which makes it a lot easier to move the information to another component.
    – Dtorr1981
    Dec 7, 2022 at 13:03

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.