Jump to content

Pass the value of an HTML element on child page to display on its parent page


Recommended Posts

I am new to PW and was trying to make a simple blog page for my website. The parent page lists previews and a few details of each blog while the child pages show individual blog posts.  The rest works well but I am struggling with one small thing. I am using Vuukle for enabling commenting on the child pages. I have a comment count HTML element on each child page as below:

<span class="vuukle-count" data=empty-text="No" name ="commentCount">0</span>Comments

Now I need to be able to pass the value of the above element from each child page to display on the parent page. I am using a foreach loop on the parent page to pull other field data from the child pages and display therein. But since the commentCount is an element on the child html page, I am not sure how to display that on the parent page. Any help is appreciated.

Thanks.

Link to comment
Share on other sites

Hi Siddhi, welcome to the forum. That has more to do with the comments system than Processwire. You have to identify what is their strategy to refer to individual blog posts from a listing page.

Your snippet of code doesn't give much away, all I can infer is that vuukle will use the url of the page to identify the post. So, I'm guessing they must have a strategy for listing pages where you pass the url of each post in the list to an attribute on that span (something like data-vuukle-url. Just guessing...). You'll need to see that in their documentation and then we can help you with implementing it in Processwire.

Maybe someone in the forum has used this system before and can help you better.

 

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...