Closed wishinghand closed 7 years ago
In comments.php on line 11 the custom page method $page->comments()
is added. The Kirby documentation on custom page methods also uses page::$methods['someName'] = function ...
to register custom page methods.
Try to enable the debug mode in Kirbys configuration and post the output here.
Here's the output:
Fatal error: Uncaught Error: Access to undeclared static property: Page::$methods in
/Applications/MAMP/htdocs/jason.land/site/plugins/comments/comments.php:11 Stack trace: #0
/Applications/MAMP/htdocs/jason.land/kirby/kirby.php(460): include_once() #1
/Applications/MAMP/htdocs/jason.land/kirby/kirby.php(433): Kirby->plugin('comments', 'dir') #2
/Applications/MAMP/htdocs/jason.land/kirby/kirby.php(745): Kirby->plugins() #3
/Applications/MAMP/htdocs/jason.land/index.php(16): Kirby->launch() #4 {main} thrown in
/Applications/MAMP/htdocs/jason.land/site/plugins/comments/comments.php on line 11
I can not reproduce this behavior. It seems like something is going wrong before the plugin is loaded, because Page::$methods
should be defined by Kirby. Try removing the lines 11–13 from comments.php (this block:
page::$methods['comments'] = function ($page) {
return Comments::for_page($page);
};
) and load your site without including any comments snippets. Does your site sill not load under those circumstances?
It still does not load after commenting out that block. Here is the error and output:
Notice: Undefined variable: kirby in /Applications/MAMP/htdocs/jason.land/site/plugins/comments/comments.php on line 18
Fatal error: Uncaught Error: Call to a member function set() on null in
/Applications/MAMP/htdocs/jason.land/site/plugins/comments/comments.php:18 Stack trace: #0
/Applications/MAMP/htdocs/jason.land/kirby/kirby.php(460): include_once() #1
/Applications/MAMP/htdocs/jason.land/kirby/kirby.php(433): Kirby->plugin('comments', 'dir') #2
/Applications/MAMP/htdocs/jason.land/kirby/kirby.php(745): Kirby->plugins() #3
/Applications/MAMP/htdocs/jason.land/index.php(16): Kirby->launch() #4 {main} thrown in
/Applications/MAMP/htdocs/jason.land/site/plugins/comments/comments.php on line 18
Undefined variable: kirby
? This problem does not seem to be caused by Kirby Comments, because the kirby
variable is undefined in the plugin loading system. What version of Kirby and Kirby Comments are you using?
Kirby version is 2.2.3 Kirby Comments version is 1.4.1
Updating to the latest Kirby version fixed it. I hadn't realized my site had gotten so far behind in the version number. Sorry about that.
Glad to hear that it works with the new version! I try to support old versions of Kirby, but it can get overwhelming to check the plugin against all versions, so I limit myself to testing new releases against the latest 2–3 versions.
I've followed the instructions to install KirbyComments using the Kirby-cli. Doing so crashes my site in MAMP and produces this error:
" Uncaught Error: Access to undeclared static property: Page::$methods in /Applications/MAMP/htdocs/jason.land/site/plugins/comments/comments.php:11 "
I'm a bit of a noob when it comes to PHP and stuff like static/protected/void so I wasn't sure how to fix this. Anyone else have this problem with installing? Installing KirbyComments manually causes the same error.