Jump to content

Recommended Posts

Posted

Hi,

I've installed the module FieldtypeComments and now I want to add comments via the  API as shown here https://processwire.com/talk/topic/357-creating-comments-via-api/

But I'm getting a  'class not found' error on this line

$c = new Comment();

I have no problem creating pages with `new Page();` but I'm unable to create a comment with `new Comment()`

Can anyone point me in the right direction?

Thanks,
Martin.

 

pw_comment_err.png

Posted

Comments.php isn't loaded automatically. It's only included when FieldtypeComments is loaded.

The quickest way to access all the auxiliary classes for this fieldtype is to load the module by calling

$modules->get('FieldtypeComments');

 

  • Like 4
  • Thanks 1
Posted

Thank you very much, that has got me up & running :-)

Thanks to your tip I've also realised that I can check 'Modules Loaded' in my Tracy debug bar if I encounter a similar situation again.

Cheers,
Martin.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...