{php} /** * 置顶模块组件 * 显示置顶文章的缩略图预览 */ $stickyArticles = $stickyArticles ?? []; $stickyCount = count($stickyArticles); $stickyLink = $stickyLink ?? '/sticky'; {/php} {if condition="$stickyCount > 0"}
置顶
{volist name="stickyArticles" id="sticky" key="k"} {if condition="$k <= 5"} {php} $stickyTitle = !empty($sticky['article_title']) ? $sticky['article_title'] : strCut(strip_tags($sticky['ptptext'] ?? ''), 10, ''); {/php}
{php} $stickyPtplx = $sticky['ptplx'] ?? ''; $stickyPtpvideo = $sticky['ptpvideo'] ?? ''; $stickyIsVideo = ($stickyPtplx === 'video' && !empty($stickyPtpvideo)); if ($stickyIsVideo) { $stickyVideoParts = explode('|', $stickyPtpvideo); $stickyVideoCover = assetUrl($stickyVideoParts[1] ?? ''); $stickyVideoUrl = assetUrl($stickyVideoParts[0] ?? ''); if (empty($stickyVideoCover)) { $stickyVideoCover = $stickyVideoUrl; } } {/php} {if condition="$stickyIsVideo && $stickyVideoCover"}
{elseif condition="!empty($sticky.article_cover)" /} {$stickyTitle} {elseif condition="!empty($sticky.ptpimag)" /} {php} $stickyImages = array_filter(explode('(+@+)', $sticky['ptpimag'])); $firstImage = !empty($stickyImages) ? assetUrl(reset($stickyImages)) : ''; {/php} {if condition="$firstImage"} {$stickyTitle} {else/}
{$stickyTitle}
{/if} {else/}
{$stickyTitle}
{/if}
{/if} {/volist}
{/if}