×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Loading comments in raw html view

Loading comments in raw html view 10 years 1 month ago #25552

  • surekey
  • surekey's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
Hi,
I am trying to load CComment in raw html view (view.raw.php) via AJAX.
My problem is that the comment form templates are loaded but are not rendered (probably because the it's a raw view).
I must use raw view for AJAX, how can I solve this problem?

Note: when I am using regular html view (view.html.php), everything works properly, but unfournately it doesn't help me :(

I've attached a screenshot with the result in my HTML.

Thanks!
Attachments:

Loading comments in raw html view 10 years 1 month ago #25553

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
You want json with the comments or what? I'm not sure that I follow what you are trying to achieve.

Loading comments in raw html view 10 years 1 month ago #25554

  • surekey
  • surekey's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
I will try to explain my self,
What I am trying to achieve is to render comment section for each post.

This is what my form looks like when view.html.php loaded:

This is what my form looks like when raw.html.php loaded into another div in ajax:

As you see , the comment section seems to disappear.
My guess is that the comment section not render the text/template.

Loading comments in raw html view 10 years 1 month ago #25555

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
You cannot get the rendered comments + form under all posts and expect it to work. That is why we have single and list view. On list view one shows the "write comment" button and on single view one shows the comments and form.
There are 2 stages to this process. Once the page loads we are adding some js to the page.
Next stage is -> the js on the page intiates an ajax request in the background. the ajax request returns the comments for the current article.
The url looks like this:
index.php?option=com_comment&task=comments.getcomments&format=json&contentid=689&component=com_content

Regards,
Daniel

Loading comments in raw html view 10 years 1 month ago #25556

  • surekey
  • surekey's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
Is there a view that can render the json response?

Loading comments in raw html view 10 years 1 month ago #25557

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
look at the utils.php helper. there you will see the functions that load the necessary view files.

Loading comments in raw html view 10 years 1 month ago #25567

  • surekey
  • surekey's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
Hi Daniel,
I failed to find the relevant function in utils.php, can you direct me to it?
Thanks.

Loading comments in raw html view 10 years 4 weeks ago #25579

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
you have loadListView and SingleView functions in there.
Those function initiate the appropriate view. Basically they render all js templates necessary for the comments to work.

Why are you trying to do that? Why do you want to show the complete list with comments under each post? There is a reason why I haven't done it yet...
  • Page:
  • 1
Time to create page: 0.206 seconds