Help - Search - Members - Calendar
Full Version: Multi Blog Counts
Movable Type Community Forum > Additional Resources > Tips and Tricks
LisaJill
Hey all,

I'm using a table format for posts/comments/comments per post that I think Maddy? posted some time ago in the plugins directory.

You can see it here:

http://www.lisajill.net/archives.php

Under that table I have a total comments and entries count.

What I would like to do, however, is to modify that table and the counts to be multi blog. They'd include 3 blogs (I have 8 on my system, at the moment). Could I encapsulte this in MTGlobalEntries to get the desired results? Really, I'm trying to make the 3 blog setup rather seemless to the end user.

This is the code that I'm using

CODE
<div class="tinytext">
<table cellspacing="2" cellpadding="0" border="0">
<tr><th>Month</th><th>Entries</th><th>Comments</th><th>Comments/Entries</th></tr>

<MTArchiveList archive_type="Monthly">
<tr>
<td><a href="<MTArchiveLink>"><$MTArchiveTitle$></a></td>
<td align="center"><$MTArchiveCount$></td>
<td align="center"><?
$comments = array(<MTEntries><$MTEntryCommentCount$>, </MTEntries>);
$commentcount = array_sum($comments);
echo $commentcount;
?></td>
<td align="center"><?
echo number_format($commentcount/<$MTArchiveCount$>,1);
?></td></tr>
</MTArchiveList>
</table>
Total Entries: <MTBlogEntryCount><br />
Total Comments: <MTBlogCommentCount>
</div>


Thanks =)
LisaJill
bumpity =)
kadyellebee
The original code for this is up on the MT Wiki: Comments Per Entry smile.gif Just for future reference. smile.gif

I played with this for a while when you first posted, but I wasn't seeming to come up with an instant answer. Can you clarify for me before I start playing again? You want a count totaling all entries across all blogs for each month?

Kristine
LisaJill
Well, what I'd really like is some way to contain the entire table into some tag (like mtglobalentries) that totals and does the division across all the blogs specified.

So it'd show all entries for that month, all comments, and all comments/per entries. I'd like to be able to textend this to the total entries and comments part that I added under the table...

So basically, the end user doesn't know that I've got 4 blogs powering the site, the counts (to that end) are inaccurate in that they only reflect the main blog....

I'm exhausted so I don't know if that makes any sense. Thanks for looking at it, I really appreciate it. =) Maybe over christmas when uni's out i'll have some time to sit down tihs ome php and figure it out... =)
stepan
I've got a new version of GlboalLists *almost* done that allows you to count across multiple blogs. It should be out "real soon now"...
LisaJill
stepan, sir, you rock.

i eagerly await the new release! =)
LisaJill
OK. Rather than starting a new thread I thought I'd post here.. Stepan released the new globalentries plugin, thank you =)

So, I modified my original code to this:

CODE
<table cellspacing="2" cellpadding="0" border="0">
<tr><th>Month</th><th>Entries</th><th>Comments</th><th>Comments/Entries</th></tr>
<MTArchiveList archive_type="Monthly">
<tr>
<td><a href="<$MTArchiveLink$>"><$MTArchiveTitle$></a></td>
<td align="center"><$MTGlobalEntryCount$></td>
<td align="center"><?
$comments = array(<$MTGlobalCommentCount$>);
$commentcount = array_sum($comments);
echo $commentcount;
?></td>
<td align="center"><?
echo number_format($commentcount/<$MTGlobalCommentCount$>,1);
?></td></tr>
</MTArchiveList>
</table>
Total Entries: <MTGlobalEntryCount include_blogs="1,8,9"><br />
Total Comments: <MTGlobalCommentCount include_blogs="1,8,9">


The parts in the table don't work, because it is not date-based it just repeats the total entries divided by the total comments.

It may not be yet in the realm of the plugin to do it - but, stepan especially... is it possible to modify this code so that it uses the monthly counts? as per the original table code?

I hope I'm not too confusing. Thank you =)

to clarify, i have the output of both the obviously mucked up code (my very iffy version) and the proper version (but limited to blog id 1) here:

http://www.lisajill.net/archives.php

thank you again!
stepan
QUOTE (LisaJill @ Dec 9 2003, 08:55 PM)
It may not be yet in the realm of the plugin to do it - but, stepan especially... is it possible to modify this code so that it uses the monthly counts?

Oops, you found a bug in v. 2.01 of GlobaListings (the count tags weren't paying attention to archives). I've fixed it in 2.02.

BTW, in a date archive context you can get the global comment count for that month using MTGlobalCommentCount (no need to mess with arrays):
CODE
<MTArchiveList archive_type="Monthly">
<tr>
<td><a href="<MTArchiveLink>"><$MTArchiveTitle$></a></td>
<td align="center"><$MTGlobalEntryCount$></td>
<td align="center"><$MTGlobalCommentCount$></td>
<td align="center"><?
echo number_format(<$MTGlobalCommentCount$>/<$MTGlobalEntryCount$>,1);
?></td></tr>
</MTArchiveList>
LisaJill
I was sitting here, having pasted your code in scratching my head going 'now why didn't that work?'

and had me a duh moment, i hadn't uploaded the new release *sighs*

things I shouldn't admit to, anyway it's absolutely perfect now, thank you!

can see it here:

http://www.lisajill.net/archives.php

this is the code I ended up using; it's still using an array cos well, it works; and I don't know enough to start fiddling.. =)

CODE
<table cellspacing="2" cellpadding="0" border="0">
<tr><th>Month</th><th>Entries</th><th>Comments</th><th>Comments/Entries</th></tr>
<MTArchiveList archive_type="Monthly">
<tr>
<td><a href="<MTArchiveLink>"><$MTArchiveTitle$></a></td>
<td align="center"><$MTGlobalEntryCount include_blogs="1,8,9"$></td>
<td align="center"><$MTGlobalCommentCount include_blogs="1,8,9"$></td>
<td align="center"><?
echo number_format(<$MTGlobalCommentCount include_blogs="1,8,9"$>/<$MTGlobalEntryCount include_blogs="1,8,9"$>,1);
?></td></tr>
</MTArchiveList>
<td>Total</td>
<td align="center"><MTGlobalEntryCount  include_blogs="1,8,9" ></td>
<td align="center"><?
$comments = array(<MTGlobalCommentCount include_blogs="1,8,9" >);
$commentcount = array_sum($comments);
echo $commentcount;
?></td>
<td align="center"><?
echo number_format($commentcount/<MTGlobalEntryCount  include_blogs="1,8,9" >,1);
?></td>
</table>


thank you again stepan! =)
kadyellebee
This is very cool! Thanks for updating the plugin Stepan, and LisaJill, thanks for posting your code! This is definately simpler than what I was doing when I played the other night. smile.gif The plugin really makes it nicer.

Kristine
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.