Renamed macro get_avatar to get_avatar_src as per suggestion.

Moved host_thumb macro into shared avatar template file.
Made condition of lazy loading a parameter.
This commit is contained in:
Gordon Stanton 2023-03-12 18:48:51 +11:00
parent ebcd906300
commit ce4aefe828
7 changed files with 12 additions and 17 deletions

View File

@ -55,7 +55,7 @@
<!--% this_host = hosts.$id %-->
<h2 class="title">Correspondent</h2>
<h2><!--% this_host.host %--></h2>
<p><img src="<!--% absolute_path(baseurl) %-->images/<!--% get_avatar(this_host.hostid) %-->"
<p><img src="<!--% absolute_path(baseurl) %-->images/<!--% get_avatar_src(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>

View File

@ -18,7 +18,7 @@
on h.hostid = e.hostid '
) %-->
<tr height="80">
<td><!--% PROCESS host_thumb avatar=get_avatar(host.hostid) host_name=host.host host_cnt=host_cnt %--></td>
<td><!--% host_thumb(get_avatar_src(host.hostid), host.host, host_cnt, 8) %--></td>
<td><strong><!--% host.host %--></strong><br>
@ -30,7 +30,3 @@
</table>
<p><a href="<!--% absolute_path(baseurl) %-->contribute.html">Become a Correspondent</a></p>
</article>
<!--% BLOCK host_thumb %-->
<img src="<!--% absolute_path(baseurl) %-->images/<!--% avatar %-->" height="80" width="80" alt="avatar of <!--% host_name | html %-->" <!--% IF host_cnt > 9 %-->loading="lazy"<!--% END %--> />
<!--% END %-->

View File

@ -16,8 +16,8 @@
<h3><!--% episode.summary %--></h3>
<p class="meta"><!--% episode_navigation %-->
</p>
<p><!--% IF get_avatar(episode.hostid) != 'hpr_logo.png' %-->
<img src="<!--% absolute_path(baseurl) %-->images/<!--% get_avatar(episode.hostid) %-->" height="80" width="80" alt="" /></a><br><!--% END %-->
<p><!--% IF get_avatar_src(episode.hostid) != 'hpr_logo.png' %-->
<img src="<!--% absolute_path(baseurl) %-->images/<!--% get_avatar_src(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_listen_in(episode.id) %--> |

View File

@ -1,5 +1,4 @@
<!--% PROCESS 'shared-avatar.tpl.html' %-->
<!--% PROCESS 'host-thumbnail.tpl.html' %-->
<!--% PROCESS 'shared-utils.tpl.html' %-->
<!--% PROCESS 'shared-listen-now.tpl.html' %-->
<!--% PROCESS 'shared-show-transcript.tpl.html' %-->
@ -44,9 +43,9 @@
<header>
<h1><a href="<!--% absolute_path(baseurl) %-->eps/hpr<!--% zero_pad_left(latest_episodes.id) %-->/index.html">hpr<!--% latest_episodes.id %--> :: <!--% latest_episodes.title %--></a></h1>
<h3><!--% latest_episodes.summary%--></h3>
<p class="meta"$><!--% IF get_avatar(latest_episodes.hostid) != 'hpr_logo.png' %-->
<p class="meta"$><!--% IF get_avatar_src(latest_episodes.hostid) != 'hpr_logo.png' %-->
<a href="<!--% absolute_path(baseurl) %-->correspondents/<!--% zero_pad_left(latest_episodes.hostid) %-->.html">
<!--% host_thumb(get_avatar(latest_episodes.hostid), latest_episodes.host, host_cnt) %-->
<!--% host_thumb(get_avatar_src(latest_episodes.hostid), latest_episodes.host, host_cnt, 0) %-->
</a><!--% END %-->
<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>

View File

@ -52,8 +52,8 @@
<h3><!--% episode.summary %--></h3>
<p class="meta"><!--% episode_navigation %-->
</p>
<p><!--% IF get_avatar(episode.hostid) != 'hpr_logo.png' %-->
<img src="<!--% absolute_path(baseurl) %-->images/<!--% get_avatar(episode.hostid) %-->" height="80" width="80" alt="" /></a><br><!--% END %-->
<p><!--% IF get_avatar_src(episode.hostid) != 'hpr_logo.png' %-->
<img src="<!--% absolute_path(baseurl) %-->images/<!--% get_avatar_src(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_listen_in(episode.id, "twat") %-->

View File

@ -1,3 +0,0 @@
<!--% MACRO host_thumb(avatar, host_name, host_cnt) BLOCK %-->
<img src="<!--% absolute_path(baseurl) %-->images/<!--% avatar %-->" height="80" width="80" alt="Thumbnail of <!--% host_name | html %-->" <!--% IF host_cnt %-->loading="lazy"<!--% END %--> />
<!--% END %-->

View File

@ -1,5 +1,8 @@
<!--% MACRO get_avatar(host_id) BLOCK %-->
<!--% MACRO get_avatar_src(host_id) BLOCK %-->
<!--% TRY %-->
<!--% USE File ("./public_html/images/hosts/${host_id}.png") %-->hosts/<!--% File.name %-->
<!--% CATCH File %-->hpr_logo.png<!--% END %-->
<!--% END %-->
<!--% MACRO host_thumb(avatar, host_name, host_cnt, min_cnt) BLOCK %-->
<img src="<!--% absolute_path(baseurl) %-->images/<!--% avatar %-->" height="80" width="80" alt="Thumbnail of <!--% host_name | html %-->" <!--% IF host_cnt > min_cnt %-->loading="lazy"<!--% END %--> />
<!--% END %-->