Add MACRO show_summary

Shared macro that generates standardized summary information about
an episode.
This commit is contained in:
Roan Horning 2022-07-31 23:09:00 -04:00
parent f6318cd34f
commit c4b0361104
Signed by: rho_n
GPG Key ID: 234AEF20B72D5769
3 changed files with 58 additions and 13 deletions

View File

@ -1,12 +1,46 @@
<!--% PROCESS 'shared-episode-summary.tpl.html' %-->
<!--% PROCESS 'shared-avatar.tpl.html' %-->
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% query_show_count = DBI.prepare('
SELECT id
FROM eps
WHERE eps.hostid = ? ')
%-->
<!--% query_shows = DBI.prepare('
SELECT
substr(\'0000\' || eps.id, -4, 4) AS [id],
CASE eps.explicit WHEN 1 THEN \'Explicit\' ELSE \'Clean\' END AS explicit ,
eps.date, eps.license, eps.duration,
eps.title, eps.summary, eps.tags,
eps.series, eps.notes,
hosts.local_image,
substr(\'0000\' || hosts.hostid, -4, 4) AS [host_id],
hosts.host, hosts.email
FROM eps INNER JOIN hosts ON eps.hostid = hosts.hostid
WHERE hosts.hostid = ?
ORDER BY date DESC ')
%-->
<!--% shows_to_count = query_show_count.execute(id); %-->
<!--% shows = query_shows.execute(id); %-->
<!--% show_count = 0 %-->
<!--% FOREACH show IN shows_to_count %-->
<!--% show_count = show_count +1; %-->
<!--% END %-->
<!--% hosts = DBI.tie('hosts', 'hostid') %-->
<article>
<!--% this_host = hosts.$id %-->
<h2 class="title">Correspondent</h2>
<h2><!--% this_host.host %--></h2>
<p><img src="./images/<!--% get_avatar(this_host.local_image, this_host.hostid) %-->"
height="80" alt="Host Image" /><br>
<label>Host ID</label>: <!--% this_host.hostid %--><br><br>
<label>email:</label> <u><!--% this_host.email %--></u><br>
<label>episodes:</label> <strong><!--% show_count %--></strong>
</p>
<h3><a href="eps.php?id=3647">hpr3647 :: Weekend projects</a></h3>
<p class="meta"><strong>Released:</strong> 2022-07-26. <strong>Duration:</strong> 00:16:44. <strong>Flag:</strong> Clean. <strong>Series:</strong> <a href="series.php?id=0">general</a>. <br>
<strong>Tags:</strong> <em>diy, repairs, umbrella, basketball</em>.<br>
Rho`n rambles about some weekend projects</p>
<p><a href="contribute.php">Become a Correspondent</a></p>
<!--% FOREACH show IN shows; %-->
<!--% show_summary(show, 'hide_host') %-->
<!--% END %-->
</article>
<p><a href="contribute.html">Become a Correspondent</a></p>

View File

@ -19,8 +19,7 @@
</p>
</article>
<hr>
<!--% MACRO show_series(series) IF series != "" %--><label>Series:</label> <a href="series.php?id=11"><!--% series %--></a>.
<!--% END %-->
<!--% PROCESS 'shared-episode-summary.tpl.html' %-->
<h1>latest shows</h1>
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% FOREACH latest_episodes IN DBI.query('
@ -82,12 +81,7 @@ ORDER BY date DESC ')
ORDER BY date DESC
')
%-->
<h3 class="title"><a href="episodes/hpr<!--% last_5_weeks_episodes.id %-->.html">hpr<!--% last_5_weeks_episodes.id %--> :: <!--% last_5_weeks_episodes.title %--></a> hosted by <a href="correspondents/host<!--% last_5_weeks_episodes.id %-->.html"><!--% last_5_weeks_episodes.host %--></a>
</h3>
<p class="meta"><span><label>Released:</label> <!--% last_5_weeks_episodes.date %-->.</span> <span><label>Duration:</label> <!--% last_5_weeks_episodes.duration %-->.</span> <span><label>Flag:</label> <!--% last_5_weeks_episodes.explicit %-->.</span> <span><!--% show_series(last_5_weeks_episodes.series) %--></span> <br>
<span><label>Tags:</label> <em><!--% last_5_weeks_episodes.tags %--></em>.</span><br>
<!--% last_5_weeks_episodes.summary %-->
</p>
<!--% show_summary(last_5_weeks_episodes) %-->
<!--% END %-->
</article>
<h1>Older Shows</h1>

View File

@ -0,0 +1,17 @@
<!--% MACRO show_series(series) IF series != "" %-->
<label>Series:</label> <a href="series.php?id=11"><!--% series %--></a>.
<!--% END %-->
<!--% MACRO show_summary(show, hide_host) BLOCK %-->
<h3 class="title"><a href="episodes/hpr<!--% show.id %-->.html">hpr<!--% show.id %--> :: <!--% show.title %--></a> <!--% IF hide_host == "" %-->
hosted by <a href="correspondents/host<!--% show.id %-->.html"><!--% show.host %--></a>
<!--% END %-->
</h3>
<p class="meta"><span><label>Released:</label> <!--% show.date %-->.</span> <span><label>Duration:</label> <!--% show.duration %-->.</span> <span><label>Flag:</label> <!--% show.explicit %-->.</span> <span><!--% show_series(show.series) %--></span> <br>
<span><label>Tags:</label> <em><!--% show.tags %--></em>.</span><br>
<!--% show.summary %-->
</p>
<!--% END %-->