applab Posted January 27 Share Posted January 27 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. Link to comment Share on other sites More sharing options...
BitPoet Posted January 28 Share Posted January 28 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'); 4 1 Link to comment Share on other sites More sharing options...
applab Posted January 28 Author Share Posted January 28 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now