<!--% PROCESS 'shared-episode-summary.tpl.html' %-->
<!--% PROCESS 'shared-avatar.tpl.html' %-->
<!--% PROCESS 'shared-utils.tpl.html' %-->
<!--% PROCESS "queries-correspondent-${constants.database}.tpl.html" %-->
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% query_hpr_show_count = DBI.prepare('
		SELECT id
		FROM eps
		WHERE eps.hostid = ? 
		')
%-->
<!--% results_hpr_shows = DBI.prepare(query_hpr_shows)
%-->
<!--% hpr_shows_to_count = query_hpr_show_count.execute(id); %-->
<!--% hpr_shows = results_hpr_shows.execute(id); %-->
<!--% hpr_show_count = 0 %-->
<!--% FOREACH show IN hpr_shows_to_count %-->
<!--% hpr_show_count = hpr_show_count +1; %-->
<!--% END %-->

<!--% query_twat_show_count = DBI.prepare('
		SELECT id
		FROM twat_eps AS eps
		WHERE eps.hostid = ?
		')
%-->
<!--% query_twat_shows = DBI.prepare('
		SELECT 
		eps.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.notes,
		hosts.local_image,
		hosts.hostid, 
		hosts.host, hosts.email,
		miniseries.name AS series, miniseries.id AS seriesid
	FROM twat_eps AS eps
	INNER JOIN hosts ON eps.hostid = hosts.hostid 
	INNER JOIN miniseries ON eps.series = miniseries.id
	WHERE hosts.hostid = ?
	ORDER BY eps.id DESC
	')
%-->
<!--% twat_shows_to_count = query_twat_show_count.execute(id); %-->
<!--% twat_shows = query_twat_shows.execute(id); %-->
<!--% twat_show_count = 0 %-->
<!--% FOREACH show IN twat_shows_to_count %-->
<!--% twat_show_count = twat_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><!--% get_avatar(this_host.hostid, this_host.host) %--><br>
		<label>Host ID</label>: <!--% this_host.hostid %--><br><br>
		<label>email:</label> <u><!--% this_host.email %--></u><br>
		<label>episodes:</label> <strong><!--% hpr_show_count + twat_show_count %--></strong>
		</p>
	<!--% FOREACH hpr_show IN hpr_shows; %-->

	<!--% show_summary(hpr_show, 'hide_host') %-->
    <p class="listen-in"><!--% display_listen_in(hpr_show.id) %--></p>
	<!--% END %-->
	<!--% FOREACH twat_show IN twat_shows; %-->

		<!--% twat_show_summary(twat_show, 'hide_host') %-->
		<p class="listen-in"><!--% display_listen_in(twat_show.id,"twat") %--></p>
    <!--% END %-->
	</article>
	<p><a href="<!--% absolute_url(baseurl) %-->about.html#so_you_want_to_record_a_podcast">Become a Correspondent</a></p>