Anyone know a way of displaying a count of children assets on a what's new page. The what's new page shows summaries of articles. Articles have 'comment' assets which i'd like to display the count of as well as name of person who posted last.
Currently i have an IFRAME embedded into the type format of the 'What's new asset'. The Iframe points to a seperate asset list that counts the assets. Would like to get rid of the IFRAME (Slow and inflexible).
Cheers and thanks
t :unsure:
You can use a nested asset listing page, with the session var set to list_current_asset_id. This will list the assets of each asset listed from the whats new page. 
I tried as you suggested (see below) but all i get is the (no results page). Is the syntax ok?
asset_id.gif (4.32 KB)
I can get it to count all assets under that root, or none but can't seem to list the child assets of that particular news asset only.
What version of Matrix are you running? This feature was not added until 3.16.6.
Also, did you make sure to set the static root node to the entire site?
[quote]What version of Matrix are you running? This feature was not added until 3.16.6.
Also, did you make sure to set the static root node to the entire site?[/quote]
Yes, all that works but it counts all of the children under the whats new page. I have news articles (under the what's new) which have their own children (Comment assets). So i want to be able to count children of one individual News asset only under the what's new page. So in effect something like below:
—
Article 1
Read more…
2 Comments, Last comment by:x
Article 2
Read more…
No comments
—
Thank you for your help
[quote]Yes, all that works but it counts all of the children under the whats new page. I have news articles (under the what's new) which have their own children (Comment assets). So i want to be able to count children of one individual News asset only under the what's new page. So in effect something like below:
—
Article 1
Read more…
2 Comments, Last comment by:x
Article 2
Read more…
No comments
—
Thank you for your help[/quote]
Yes using list_current_asset_id is the way to go here. Let me get this straight. You have a whats new page, which lists news items, each news item has child comments. For each news item, you want to print how many child assets/comments there are. Correct?
I am not sure what is wrong here, as this should work. We do this all the time on puc.edu, as well as my own website.
Do you have a few more screen shots of how you have these assets configured, as well as an example page?
Yep, that's exactly right. Here's my nested asset listing that should be counting the assets.
One more thing: Not sure about the "static root node" - where do i set that and how would it affect the site? comment_al.gif (106 KB)
With the above setting I get the same response for each news asset (ie counting all COMMENT assets under root node). Eg:
20 comment(s)
Last comment: taip, 08 Jul 2008 11:28pm
[quote]With the above setting I get the same response for each news asset (ie counting all COMMENT assets under root node). Eg:
20 comment(s)
Last comment: taip, 08 Jul 2008 11:28pm[/quote]
Can you try setting the root node to the site asset? Also, check your error.log to see if that gives you any clue.
Hi
Do I need to put a special keyword in the type format to make the number appear?
Thanks
Tim
[quote]
Anyone know a way of displaying a count of children assets on a what's new page. The what's new page shows summaries of articles. Articles have 'comment' assets which i'd like to display the count of as well as name of person who posted last.
Currently i have an IFRAME embedded into the type format of the 'What's new asset'. The Iframe points to a seperate asset list that counts the assets. Would like to get rid of the IFRAME (Slow and inflexible).
Cheers and thanks
t :unsure:
[/quote]
Hi, how did you create the "a seperate asset list that counts the assets."?
Thanks
[quote]
Hi, how did you create the "a seperate asset list that counts the assets."?
[/quote]
You need to create a second asset listing which you nest in the type format of the first. The second asset listing gets the dynamic param session var set to list_current_asset_id, which allows that asset listing to use each child of the first listing as a root node, therefore allowing it to show how many children exist.
Do a search for list_current_asset_id here on the forums and you will find a large amount of info on the subject.
[quote]
You need to create a second asset listing which you nest in the type format of the first. The second asset listing gets the dynamic param session var set to list_current_asset_id, which allows that asset listing to use each child of the first listing as a root node, therefore allowing it to show how many children exist.
Do a search for list_current_asset_id here on the forums and you will find a large amount of info on the subject.
[/quote]
Thanks for that
yep set up a second asset listing - asset b - and I'm using the list_current_asset_id on asset listing b.
I have nested asset listing b within the type format of asset listing a.
Problem is I don't know what to do next. In the type format of asset listing a I have written "Comments ()" but don't know what to put between the brackets.
I've checked through the forums but can't find the answer
I'm getting close though because the number of times that this line is repeated on the front end: "Comments ()" equals the number of comments there are.
[quote]
Thanks for that
yep set up a second asset listing - asset b - and I'm using the list_current_asset_id on asset listing b.
I have nested asset listing b within the type format of asset listing a.
Problem is I don't know what to do next. In the type format of asset listing a I have written "Comments ()" but don't know what to put between the brackets.
I've checked through the forums but can't find the answer
I'm getting close though because the number of times that this line is repeated on the front end: "Comments ()" equals the number of comments there are.
[/quote]
I worked it out weehhooo. I needed to enter "Comment(s) %asset_count% %asset_listing%" into the Page Contents of the asset listing and in the type formats I needed to enter %list_current_asset_id%…I'm glas I worked that out before the weekend
[quote]
I worked it out weehhooo
[/quote]
Awesome! Glad you got it working.