Page 1 of 2
Call to a member function get() on null
Posted: 08 Jul 2018, 21:58
by kgvweb
Hello.
I don't get it... Installed PhocaPDF straight to instruction from
https://www.phoca.cz/documents/47-phoca ... joomla-3-3...
I tried to install with System Plugin an tried to code manually. I copied the code to overwrite directory but there doesn't seem to happen something.
I copied the code to mytemplate/html/com_content/article/default.php. This is the only file, where changes can be seen in frontend (Tested it with some text - simply inserted "Test" to li-element -> This "Test" will appear in frontend). When i insert the code from the instructions:
Code: Select all
$phocaPDF = false;
if (JPluginHelper::isEnabled('phocapdf', 'content')) {
include_once(JPATH_ADMINISTRATOR.'/components/com_phocapdf/helpers/phocapdf.php');
$phocaPDF = PhocaPDFHelper::getPhocaPDFContentIcon($displayData['item'], $displayData['params']);
}
and
and furhtermore
i get a "call to member function" error.... With commenting I found, that the error comes when line
Code: Select all
$phocaPDF = PhocaPDFHelper::getPhocaPDFContentIcon($displayData['item'], $displayData['params']);
is parsed.
My Joomla: 3.8.10
My PhocaPDF Component: 3.0.5
My PhocaPDF Content: 3.0.5
My PHP: 7.2
What is wrong with me? (or my code... :) )
Re: Call to a member function get() on null
Posted: 10 Jul 2018, 13:57
by Jan
Which error do you get exactly?
Jan
Re: Call to a member function get() on null
Posted: 10 Jul 2018, 20:57
by kgvweb
Hi Jan,
thanks for your reply.
I get the "0 - Call to a member function get() on null" error message with no more comment.
When I go step-by-step then I'll found, that the error occurs when line with
Code: Select all
$phocaPDF = PhocaPDFHelper::getPhocaPDFContentIcon($displayData['item'], $displayData['params']);
is parsed.
Heiko.
Re: Call to a member function get() on null
Posted: 13 Jul 2018, 15:25
by Jan
But do you get exact error message including all the lines (php error displayed + debug mode, should display all the functions called before this error)
Jan
Re: Call to a member function get() on null
Posted: 03 Aug 2018, 16:54
by kgvweb
Hi,
I'm sorry for no more answering. The problem exists right now. When I turn on the debug-mode, I get the following error message:
Code: Select all
Call to a member function get() on null
/mnt/web105/b1/68/52400668/htdocs/joomla_01/administrator/components/com_phocapdf/helpers/phocapdf.php:91
Call stack
# Function Location
1 () JROOT/administrator/components/com_phocapdf/helpers/phocapdf.php:91
2 PhocaPDFHelper::getPhocaPDFContentIcon() JROOT/templates/joomspirit_123/html/com_content/article/default.php:15
3 include() JROOT/libraries/src/MVC/View/HtmlView.php:695
4 Joomla\CMS\MVC\View\HtmlView->loadTemplate() JROOT/libraries/src/MVC/View/HtmlView.php:230
5 Joomla\CMS\MVC\View\HtmlView->display() JROOT/components/com_content/views/article/view.html.php:210
6 ContentViewArticle->display() JROOT/libraries/src/MVC/Controller/BaseController.php:672
7 Joomla\CMS\MVC\Controller\BaseController->display() JROOT/components/com_content/controller.php:113
8 ContentController->display() JROOT/libraries/src/MVC/Controller/BaseController.php:710
9 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/components/com_content/content.php:43
10 require_once() JROOT/libraries/src/Component/ComponentHelper.php:382
11 Joomla\CMS\Component\ComponentHelper::executeComponent() JROOT/libraries/src/Component/ComponentHelper.php:357
12 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/SiteApplication.php:194
13 Joomla\CMS\Application\SiteApplication->dispatch() JROOT/libraries/src/Application/SiteApplication.php:233
14 Joomla\CMS\Application\SiteApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:195
15 Joomla\CMS\Application\CMSApplication->execute() JROOT/index.php:49
Could this help to solve the problem?
Thank you for helping...
Re: Call to a member function get() on null
Posted: 03 Aug 2018, 20:06
by kgvweb
Next hint: It doesn't seem to change anything either if I add the code from manual to layouts/joomla/content/icons.php or templates/your_template/html/layouts/com_content/icons.php. Even changing the filename "icons.php" to "this_sucks.php" doesn't take any effect...
templates/your_template/html/layouts/com_content/icons.php (your_template replaced by joomspirit123) doesn't even exist... Icons.php is found at templates/your_template/html/layouts/joomla/content instead.
Changes only will be show in frontend when editing mytemplate/html/com_content/article/default.php. Is that correct?
Re: Call to a member function get() on null
Posted: 07 Aug 2018, 13:41
by Jan
Hi, in this file:
JROOT/templates/joomspirit_123/html/com_content/article/default.php:15
the function must get parameters:
Code: Select all
getPhocaPDFContentIcon($item, $params, $attribs = array()) {
at least two parameters: $item, $params
Does it include both?
Jan
Re: Call to a member function get() on null
Posted: 23 Oct 2018, 22:38
by kgvweb
Solved!
Icon is shown now, but not only the PDF-Icon, even a empty document icon. Both the same link.
the following code is being generated:
Code: Select all
<li class="print-icon"><a href="/index.php/aktuelles/elster?id=&tmpl=component&format=pdf" onclick="window.open(this.href,'win2','status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no'); return false;" title="PDF" rel="nofollow"><span class="glyphicon glyphicon-file icon-file"></span><img src="/media/com_phocapdf/images/pdf_button.png" alt="PDF"></a></li>
not enough problems: furthermore there is only an empty PDF to be generated, which seems to be damaged (not to open with adobe reader, browser displays empty pdf). For this problem I search the solution in any other threads.
Re: Call to a member function get() on null
Posted: 24 Oct 2018, 14:30
by Jan
Ok
Re: Call to a member function get() on null
Posted: 25 Oct 2018, 11:24
by kgvweb
Thank you so much for helping me, simply syntax error with my code after four months of searching -.-
I inserted the snippet in "default.php" of template override with following substitution:
Code: Select all
$phocaPDF = PhocaPDFHelper::getPhocaPDFContentIcon($this->item, $params, array(), true);
instead of
Code: Select all
$phocaPDF = PhocaPDFHelper::getPhocaPDFContentIcon($item, $params, $attribs=array());
in line 24 and everything works great. The only thing now is, that the icon is shown as "double icon". but this doesn't matters any more...
Thanks for your great support!!!! Topic can be marked as "solved".