Search the Community
Showing results for tags 'fieldtypecomments'.
-
Hi everyone, I am new to processwire and I love it so far but got a bit of challenges with the FieldTypeComments module. I have been working on a website that has groups, in each group members can post images, youtube video or plain text that will create a new child to the group (group-post). I have a basic form for this, filling the fields of the new page with the different inputs the members want to share. The idea is that members can also respond to someone else's post, hence those page children have the comment field from FieldTypeComments module. (basically : home/groups/group/group-post) The pages having the group-post template aren't supposed to be accessed directly, only the page having the group template. All the content of their fields are called this way : <!-- //group template --> <?php //get children (group-post template) foreach ($page->children->find("sort=-created") as $post ){ echo $post->title; echo "<p class='CommentHeader'>"; $post->of(false); $numTotal = $post->comments->count(); if($numTotal <= 1){ echo "{$numTotal} comment"; }else{ echo "{$numTotal} comments"; } echo "</p>"; echo $post->body; if($post->get('comments')->count()){ $list = $post->comments->getCommentList([ 'className' => 'CommentListCustom', ]); $list->setMarkup([ 'noticeMessage' => "<div id='{id}' class='uk-alert {class}'>{message}</div>", 'noticeSuccessClass' => 'uk-alert-success', 'noticeErrorClass' => 'uk-alert-danger', 'list' => "<ul id='my-comments-list' class='{class}'>{comments}</ul>", // and so on for any other $markup properties ]); echo $list->render(); }else{ echo"<small><p style='text-align:center;'>No comment yet, be the first!</p></small>"; } $form = $post->comments->getCommentForm([ 'className' => 'CommentFormCustom', ]); $formMarkup = " <form class='{form.class} discussions_message ' id='my-comment-form' action='{form.action}' method='{form.method}' {form.attrs}> <div class='avatar'>"; if(count($user->images)){ //profile image for the user since I am not using gravatar $imgUrl = $user->images->last()->url; } else{ $imgUrl = $user->url; } $formMarkup .= "<img src='{$imgUrl}' data-src='{$imgUrl}'>"; $formMarkup .= " </div> <p class='{cite.wrap.class}'> <label class='{label.class}'> <span class='{label.span.class}'>{cite.label}</span> <textarea name='{cite.input.name}' class='{cite.input.class}' required='required' value='{cite.input.value}' >{cite.input.value}</textarea> </label> </p> <p class='{email.wrap.class}'> <label class='{label.class}'> <span class='{label.span.class}'>{email.label}</span> <textarea name='{email.input.name}' class='{email.input.class}' required='required' value='{email.input.value}' >{email.input.value}</textarea> </label> </p> {if.website} <p class='{website.wrap.class}'> <label class='{label.class}'> <span class='{label.span.class}'>{website.label}</span> <input type='text' name='{website.input.name}' class='{website.input.class}' value='{website.input.value}' maxlength='255' /> </label> </p> {endif.website} {if.stars} <p class='{stars.wrap.class}' {stars.wrap.attrs}> <label class='{label.class}'> <span class='{label.span.class}'>{stars.label}</span> {stars.markup} </label> </p> {endif.stars} {if.honeypot} <p class='{honeypot.wrap.class}'> <label> <span>{honeypot.label}</span> <input type='text' name='{honeypot.input.name}' value='{honeypot.input.value}' size='3' /> </label> </p> {endif.honeypot} <p class='{text.wrap.class}'> <label class='{label.class}'> <textarea style='border: 1.5px solid !important;' name='text' class='{text.input.class} my-comment my-new-comment' required='required' rows='{text.input.rows}' cols='{text.input.cols}'>{text.input.value}</textarea> </label> </p> {if.notify} <p class='{notify.wrap.class}'> <label class='{notify.label.class}'> <span class='{notify.label.span.class}'>{notify.label}</span> </label> <label class='{notify.input.label.class}'> <input class='{notify.input.class}' type='radio' name='{notify.input.name}' checked='checked' value='{notify.input.off.value}' {notify.input.off.checked}/> {notify.input.off.label} </label> {if.notify.replies} <label class='{notify.input.label.class}'> <input class='{notify.input.class}' type='radio' name='{notify.input.name}' value='{notify.input.replies.value}' {notify.input.replies.checked}/> {notify.input.replies.label} </label> {endif.notify.replies} {if.notify.all} <label class='{notify.input.label.class}'> <input class='{notify.input.class}' type='radio' name='{notify.input.name}' value='{notify.input.all.value}' {notify.input.all.checked}/> {notify.input.all.label} </label> {endif.notify.all} </p> {endif.notify} <p class='{submit.wrap.class}'> <button type='submit' class='{submit.input.class} button' name='{submit.input.name}' value='{submit.input.value}'>Reply</button> {form.hidden.inputs} </p> </form> "; $form->markup('form', $formMarkup); $form->labels('submit', 'Submit Feedback'); $form->labels('notify', 'Email Me'); // form notifications $form->markup('notification', "<div class='uk-alert {class}'>{message}</div>"); $form->classes('success', 'uk-alert-success'); $form->classes('pending', 'uk-alert-warning'); $form->classes('error', 'uk-alert-danger'); echo $form->render(); } ?> I use the comment module on different templates that have different behaviors. It works so perfectly when the comment field is on the page receiving comments, but for the case of my group-post the comments are added from the group template to the group-post template. It actually works fine when the group only has 1 child, votes included, however, when there is multiple children the comments are always adding up to the last group-post created. I am worried to touch the module itself since I am still starting with ProcessWire modules and I don't want to mess up in anything before asking a bit of help, I am more than aware that this might be an unusual use of the FieldTypeComments module... Does someone ever had this issue and found a way to keep my other comment field commenting the page there are on, but making sure that the group-post comments are adding in the right group-post child? Sorry if it feels messy, and let me know if you need something else for giving some clues ? Any help would be greatly appreciated!
-
I'm working on the threaded comments on my website and for this I need to include the comments.js When I do this it keeps on giving me the "Uncaught ReferenceRrror: jQuery is not defined". Whatever I do it keeps giving me this error message. It's the last javascript file that I load in. So how do I fix it?
- 2 replies
-
- comments
- referenceerror
-
(and 2 more)
Tagged with: