Add MACRO display_comments_tally
This commit is contained in:
parent
91cbc81a12
commit
cfd463d2b0
@ -26,6 +26,13 @@
|
||||
INNER JOIN episode_date
|
||||
ON eps.date > episode_date.date
|
||||
WHERE eps.date < date (\'now\')
|
||||
),
|
||||
comment_tallies AS (
|
||||
SELECT
|
||||
eps_id,
|
||||
COUNT(eps_id) AS eps_tally
|
||||
FROM comments
|
||||
GROUP BY eps_id
|
||||
)
|
||||
SELECT eps.id, eps.date, eps.title, eps.duration,
|
||||
eps.summary, eps.notes, eps.explicit, eps.license,
|
||||
@ -33,13 +40,14 @@
|
||||
episode_maxmin.latest, episode_maxmin.earliest,
|
||||
episode_previous.previous, episode_next.next,
|
||||
hosts.hostid, hosts.host,
|
||||
miniseries.name AS \'series\', miniseries.id AS \'seriesid\'
|
||||
COALESCE (comment_tallies.eps_tally, 0) AS eps_tally
|
||||
FROM eps
|
||||
INNER JOIN hosts ON eps.hostid = hosts.hostid
|
||||
INNER JOIN miniseries ON eps.series = miniseries.id
|
||||
INNER JOIN episode_maxmin ON eps.id = episode_maxmin.id
|
||||
INNER JOIN episode_previous ON eps.id = episode_previous.id
|
||||
INNER JOIN episode_next ON eps.id = episode_next.id
|
||||
LEFT JOIN comment_tallies ON eps.id = comment_tallies.eps_id
|
||||
WHERE eps.id = ?
|
||||
')
|
||||
%-->
|
||||
@ -56,6 +64,7 @@
|
||||
<img src="<!--% absolute_path(baseurl) %-->images/<!--% get_avatar(episode.hostid) %-->" height="80" width="80" alt="" /></a><br><!--% END %-->
|
||||
Hosted by <a href="<!--% absolute_path(baseurl) %-->correspondents/<!--% zero_pad_left(episode.hostid) %-->.html"><!--% episode.host %--></a> on <span><!--% episode.date %--></span> is flagged as <span><!--% display_explicit(episode.explicit) %--></span> and is released under a <span><!--% episode.license %--> license</span>. <br>
|
||||
<!--% display_tags(episode.tags) %--> <br>
|
||||
<!--% display_comments_tally(episode.id, episode.eps_tally) %-->
|
||||
</header>
|
||||
<div><!--% episode.notes %--></div>
|
||||
</article>
|
||||
|
@ -58,7 +58,7 @@
|
||||
<br>Hosted by <a href="<!--% absolute_path(baseurl) %-->correspondents/<!--% zero_pad_left(latest_episodes.hostid) %-->.html"><!--% latest_episodes.host %--></a> on <!--% latest_episodes.date %--> is flagged as <!--% display_explicit(latest_episodes.explicit) %--> and released under a <!--% latest_episodes.license %--> license. <br>
|
||||
<!--% display_tags(latest_episodes.tags) %--><br>
|
||||
<small>listen in <a href="local/hpr<!--% latest_episodes.id %-->.ogg">ogg</a>, <a href="local/hpr<!--% latest_episodes.id %-->.spx">spx</a>, or <a href="local/hpr<!--% latest_episodes.id %-->.mp3">mp3</a> format. <!--% show_series(latest_episodes.series, latest_episodes.seriesid) %-->
|
||||
<a href="<!--% absolute_path(baseurl) %-->eps/hpr<!--% zero_pad_left(latest_episodes.id) %-->/index.html#comments">Comments (<!--% latest_episodes.eps_tally %-->)</a>.</small>
|
||||
<!--% display_comments_tally(latest_episodes.id, latest_episodes.eps_tally) %--></small>
|
||||
</p>
|
||||
</header>
|
||||
<!--% latest_episodes.notes %-->
|
||||
|
@ -5,6 +5,9 @@
|
||||
<span><label>Tags:</label> <em><!--% tags %--></em>.</span>
|
||||
<!--% END %-->
|
||||
|
||||
|
||||
<!--% MACRO display_comments_tally(eps_id, tally) BLOCK %-->
|
||||
<a href="<!--% absolute_path(baseurl) %-->eps/hpr<!--% zero_pad_left(eps_id) %-->/index.html#comments">Comments (<!--% tally %-->)</a>.
|
||||
<!--% END %-->
|
||||
|
||||
<!--% MACRO show_meta(show) BLOCK %-->
|
||||
|
Reference in New Issue
Block a user