Undefined array key 1

113 views
Skip to first unread message

Taelor Taylor

unread,
Nov 11, 2021, 7:20:52 PM11/11/21
to Joomla! General Development
Hi,
I am totally inexperienced with Joomla and website building in general, so your patience is very much appreciated!

I am getting this error on the top of my web page:
Warning: Undefined array key 1 in /public_html/templates/drloritaylor/library/Core/Content/Item.php on line 80

I have had a look at the <Item.php> file, but cannot make sense of it. The following is a copy of lines 71-85, with line 80 highlighted:

private function _buildIcon($text, $file, $alt, $wrapUpTooltip = false) {
        $app = Factory::getApplication();
        $src = Uri::root(true) . '/templates/' . $app->getTemplate();
        preg_match('/<a[^>]*>([\s\S]*?)<\/a>/', $text, $matches);
        $linkContent = $matches[1];
        $newLinkContent = '<img src="' . $src . '/images/system/' . $file . '" alt="' . $alt . '" />';
        $text = str_replace($linkContent, $newLinkContent, $text);
        if ($wrapUpTooltip) {
            preg_match('/title="([^"]*)"/', $linkContent, $matches);
            $tooltipText = $matches[1];
            $tooltipText = preg_replace('/<strong>(.*?)<\/strong><br \/>/', '$1 :: ', $tooltipText);
            $text = '<span class="hasTip" title="' . $tooltipText . '">' . $text . '</span>';
        }
        return $text;
    }

I am hoping someone will be able to give me an idea of how I should correct this error.
Thanks!
Taelor

Reply all
Reply to author
Forward
0 new messages