To display videos within the current category in Apple CMS, you can use the template tag.{maccms:vod}的type="current"Parameter Implementation. The following outlines the specific steps and extended configuration instructions:
{maccms:vod num="12" type="current" order="desc" by="hits"}
<li class="clear">
<a class="thumbnail-link"
href="{:mac_url_vod_play($vo,1,1)}"
rel="bookmark">
<div class="thumbnail-wrap">
<img src="{$vo.vod_pic}" />
<div class="video-duration">{$vo.vod_year}</div>
</div>
</a>
<div class="entry-wrap">
<a href="{:mac_url_vod_play($vo,1,1)}"
rel="bookmark">{$vo.vod_name}</a>
<div class="entry-meta">
<span class="entry-views">
<i class="fa fa-eye"></i>
<span class="view-count">{$vo.vod_hits}次观看</span>
</span>
<span class="sep"> · </span>
<span class="entry-date">{$vo.vod_time|mac_day}</span>
</div>
</div>
</li>
{/maccms:vod}I. Basic Call Code
In template files (e.g.vodplay.htmlAdd the following code to the column page template:
{maccms:vod num="10" type="current" order="desc" by="time"}- Parameter parsing:
num="10"Call 10 videos (can be customized as needed).type="current"Limited to videos within the current section.order="desc" by="time"Sort by publication date in descending order (latest videos first).
II. Extended Configuration Scenarios
1. Sort by view count (Popular Videos)
{maccms:vod num="10" type="current" order="desc" by="hits"}2. Randomly play videos from this section
{maccms:vod num="10" type="current" order="rand"}3. Only videos with a recommended value ≥ 5 will be displayed.
{maccms:vod num="10" type="current" order="desc" by="hits" level="5"}(Please set the recommendation value in the video editing page in advance.)
4. Exclude the current video itself (to avoid duplicate recommendations)
{maccms:vod num="10" type="current" id="!{$maccms.vod.vod_id}"}III. Front-end Display Example
<div class="current-videos">
{maccms:vod num="10" type="current" order="desc" by="time"}
<div class="video-card">
<a href="{$vo.vod_play_url}">
<img src="{$vo.vod_pic}" alt="{$vo.vod_name}">
<h3>{$vo.vod_name}</h3>
<p>更新至:{$vo.vod_serial}</p>
</a>
</div>
{/maccms:vod}
</div>
<style>
.current-videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.video-card img { width: 100%; height: 280px; object-fit: cover; border-radius: 8px; }
.video-card h3 { font-size: 16px; margin: 8px 0; }
.video-card p { color: #666; font-size: 14px; }
</style>IV. Key Considerations
- Column ID matching
- Ensure that the template file is bound to the target section (for example, the section page template must correspond to the correct category ID).
- When called on the playback page,
type="current"It will automatically inherit the category to which the current video belongs.
- performance optimization
- When the video volume is large, it is recommended to run the process in the background. System → Planned Tasks Enable "Auto Generate Classification Cache".
- Avoid excessive API calls on high-traffic pages (e.g., the homepage).
numThe value should not be too large).
- Cache cleanup
- After modifying the template, please access the Apple CMS backend. Click "Clear Cache" in the top-right corner.Otherwise, the frontend may not be updated.
V. Advanced Application Scenarios
1. Combined Label Filtering
Retrieve videos from the current section that contain a specific tag (e.g., "4K" tag):
{maccms:vod num="10" type="current" tag="4K"}2. Cross-column invocation (but prioritizes the current column)
If the current section contains fewer than 10 videos, additional data from other sections will be automatically supplemented:
{maccms:vod num="10" type="current,other" order="rand"}3. Play sub-section video
If the current section has child categories, recursively call the videos for all child sections:
{maccms:vod num="10" type="current,child" order="desc" by="time"}With the above configuration, you can flexibly meet diverse video invocation requirements for current sections – making it ideal for scenarios such as associated recommendations on playback pages or content populating on section pages.
Tag Directory
http://Apple Label Reference Table (Official Website Document – Video Sorting Tag Input)