Add get_avatar macro

Print hpr logo or host avatar filename.
This commit is contained in:
Roan Horning 2022-07-31 22:25:15 -04:00
parent 858bf058ff
commit f6318cd34f
Signed by: rho_n
GPG Key ID: 234AEF20B72D5769
4 changed files with 13 additions and 10 deletions

View File

@ -1,10 +1,8 @@
<!--% PROCESS 'shared-avatar.tpl.html' %-->
<article> <article>
<h2 class="title">Correspondent</h2> <h2 class="title">Correspondent</h2>
<h2>Rho`n</h2> <p><img src="./images/<!--% get_avatar(this_host.local_image, this_host.hostid) %-->"
<p><img src="./images/hosts/293.png" height="80" alt="Host Image" /><br> height="80" alt="Host Image" /><br>
<label>Host ID</label>:<!--% id %--><br><br>
<label>email:</label> <u>roan.horning.nospam@nospam.gmail.com</u><br>
<label>episodes:</label> <strong>12</strong>
</p> </p>
<h3><a href="eps.php?id=3647">hpr3647 :: Weekend projects</a></h3> <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> <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>

View File

@ -3,6 +3,7 @@
<p> <p>
<h2 class="title">Correspondents</h2><p>For more information on how to become a Correspondent see our <a href="contribute.php">contribute</a></center> page. To add a logo here, either email one to admin at hpr or setup your email on <a href="https://en.gravatar.com/">Gravatar</a>. To protect your browsing privacy we gather the images every hour and serve them directly from HPR.<p /> <h2 class="title">Correspondents</h2><p>For more information on how to become a Correspondent see our <a href="contribute.php">contribute</a></center> page. To add a logo here, either email one to admin at hpr or setup your email on <a href="https://en.gravatar.com/">Gravatar</a>. To protect your browsing privacy we gather the images every hour and serve them directly from HPR.<p />
<!--% USE DBI(constants.driver, constants.user, constants.password) %--> <!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% PROCESS 'shared-avatar.tpl.html' %-->
<table> <table>
<th >Avatar</th> <th >Avatar</th>
<th >Name &amp; Host ID</th> <th >Name &amp; Host ID</th>
@ -10,13 +11,13 @@
<th >Last Show</th> <th >Last Show</th>
<!--% FOREACH host IN DBI.query( <!--% FOREACH host IN DBI.query(
'select h.hostid, h.host, h.license, e.date, 'select h.hostid, h.host, h.license, e.date,
CASE WHEN h.local_image = 0 THEN \'hpr_logo\' ELSE h.hostid END AS avatar h.local_image
from hosts as h from hosts as h
inner join (select hostid, max(date) as date from eps group by hostid) as e inner join (select hostid, max(date) as date from eps group by hostid) as e
on h.hostid = e.hostid ' on h.hostid = e.hostid '
) %--> ) %-->
<tr height="80" bgcolor="#CCCCCC"> <tr height="80" bgcolor="#CCCCCC">
<td><img src="./images/<!--% host.avatar%-->.png" height="80" width="80" alt="avatar" /></td> <td><img src="./images/<!--% get_avatar(host.local_image, host.hostid) %-->" height="80" width="80" alt="avatar" /></td>
<td><strong><!--% host.host %--></strong><br /> <td><strong><!--% host.host %--></strong><br />

View File

@ -1,3 +1,4 @@
<!--% PROCESS 'shared-avatar.tpl.html' %-->
<hr> <hr>
<article> <article>
<header> <header>
@ -29,8 +30,8 @@
eps.date, eps.license, eps.duration, eps.date, eps.license, eps.duration,
eps.title, eps.summary, eps.tags, eps.title, eps.summary, eps.tags,
eps.series, eps.notes, eps.series, eps.notes,
CASE hosts.local_image WHEN 1 THEN hosts.hostid ELSE \'hpr_logo\' END AS avatar, hosts.local_image,
substr(\'0000\' || hosts.hostid, -4, 4) AS [host_id], hosts.hostid,
hosts.host, hosts.email hosts.host, hosts.email
FROM eps INNER JOIN hosts ON eps.hostid = hosts.hostid FROM eps INNER JOIN hosts ON eps.hostid = hosts.hostid
WHERE eps.date BETWEEN date(\'now\', \'-7 days\') AND date(\'now\') WHERE eps.date BETWEEN date(\'now\', \'-7 days\') AND date(\'now\')
@ -41,7 +42,7 @@ ORDER BY date DESC ')
<header> <header>
<h1><a href="episodes/hpr<!--% latest_episodes.id %-->.html">hpr<!--% latest_episodes.id %--> :: <!--% latest_episodes.title %--></a></h1> <h1><a href="episodes/hpr<!--% latest_episodes.id %-->.html">hpr<!--% latest_episodes.id %--> :: <!--% latest_episodes.title %--></a></h1>
<h3><!--% latest_episodes.summary%--></h3> <h3><!--% latest_episodes.summary%--></h3>
<p class="meta"$><img src="./images/hosts/<!--% latest_episodes.avatar %-->.png" height="80" width="80" alt="" /></a><br>Hosted by <a href="correspondents/host<!--% latest_episodes.host_id %-->.html"><!--% latest_episodes.host %--></a> on <!--% latest_episodes.date %--> is flagged as <!--% latest_episodes.explicit %--> and released under a <!--% latest_episodes.license %--> license. <br> <p class="meta"$><img src="./images/<!--% get_avatar(latest_episodes.local_image, latest_episodes.hostid) %-->" height="80" width="80" alt="" /></a><br>Hosted by <a href="correspondents/host<!--% latest_episodes.host_id %-->.html"><!--% latest_episodes.host %--></a> on <!--% latest_episodes.date %--> is flagged as <!--% latest_episodes.explicit %--> and released under a <!--% latest_episodes.license %--> license. <br>
<strong>Tags:</strong> <!--% latest_episodes.tags %--><em></em>.<br> <strong>Tags:</strong> <!--% latest_episodes.tags %--><em></em>.<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) %--> <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) %-->
<a href="eps.php?id=3628#comments">comments (0)</a></small> <a href="eps.php?id=3628#comments">comments (0)</a></small>

View File

@ -0,0 +1,3 @@
<!--% MACRO get_avatar(has_avatar, host_id) BLOCK %-->
<!--% IF has_avatar == 0 %-->hpr_logo.png<!--% ELSE %-->hosts/<!--% host_id %-->.png<!--% END %-->
<!--% END %-->