templaza / astroid-framework

Powerful framework for designers and developers to create responsive, fast & robust Joomla based websites and templates.
https://astroidframe.work/
GNU General Public License v3.0
77 stars 12 forks source link

ClassNotFoundError Template One after upgrade to Joomla 5 #597

Closed udospr closed 3 months ago

udospr commented 3 months ago

Hi, I updated Astroid and Tempate One to version 3.0.11 and upgraded Joomla to version 5.0.3 This results in an error when the Backwards Compatibility plugin is unpublished. Class "JHtml" not found Location: JROOT\templates\astroid_template_one\html\mod_menu\default_component.php:43

The lines 34-50 of this file are:

if ($item->menu_image)
{
    if ($item->menu_image_css)
    {
        $image_attributes['class'] = $item->menu_image_css;
        $linktype = JHtml::_('image', $item->menu_image, $item->title, $image_attributes);
    }
    else
    {
        $linktype = JHtml::_('image', $item->menu_image, $item->title);
    }

    if ($item->getParams()->get('menu_text', 1))
    {
        $linktype .= '<span class="image-title">' . $item->title . '</span>';
    }
}

When using a child template of Temple One I get this in the stack trace

Symfony\Component\ErrorHandler\Error\ClassNotFoundError:
Attempted to load class "JHtml" from the global namespace.
Did you forget a "use" statement?

at C:\xampp\htdocs\stenen\templates\astroid_template_one\html\mod_menu\default_component.php:43

When I comment out lines 41-44 (else ..... } ) the problem is gone.

How to solve this problem?

sonvnn commented 3 months ago

Thank you! I will soon update One to latest.

udospr commented 2 months ago

Alas, this 'solution' created a big problem afer updating Template One to version 3.0.12 The override templates\astroid_template_one\html\mod_menu\default_component.php now has only 1 line:

require Astroid\Helper\Overrides::getHTMLTemplate();

The result is a fatal error ERROR 0 - Failed opening required '\mod_menu\default_component.php'

So I had to downgrade to Template One 3.0.11 and activate the Backwards Compatibility plugin. Please advise.

Udo

udospr commented 2 months ago

Latest news: I replaced the line require Astroid\Helper\Overrides::getHTMLTemplate(); by the code of the original file mod_menu\default_component.php and now it seems to work fine.