平台概述
开发者指引
开发文档
平台政策
联系我们
API文档
模板标签说明
标签的使用,请参照:web/themes/autumn/TopxiaWebBundle/views/Default/index.html.twig 。
获取最新课程列表的例子:
{% set courses = data('LatestCourses',{'count':count, 'categoryId':categoryId}) %}
| 对象 | 标签名称 | 参数 | 功能说明 |
|---|---|---|---|
| Course | [必须] courseId: 课程ID | 获取一个课程对象 | |
| LatestCourses | [可选] categoryId:分类ID [必须] count:课程数量,取值不能超过100 |
获取最新课程列表 | |
| PopularCourses | [可选] categoryId:分类ID [必须] count:课程数量,取值不能超过100 |
获取热门课程列表 | |
| RecommendCourses | [可选] categoryId:分类ID [必须] count:课程数量,取值不能超过100 |
获取推荐课程列表 | |
| FreeCourses | [可选] categoryId:分类ID [必须] count:课程数量,取值不能超过100 |
获取免费课程列表 | |
| TeacherCourses | [必须] userId: 老师ID [必须] count:课程数量,取值不能超过100 |
获取一个老师的课程列表 | |
| CourseRankByRating | [必须] count:课程数量,取值不能超过100 | 获取按评分排列的课程排行列表 | |
| CourseRankByStudent | [必须] count:课程数量,取值不能超过100 | 获取按学员数排列的课程排行列表 | |
| CourseRankByHit | [必须] count:课程数量,取值不能超过100 | 获取按点击数排列的课程排行列表 | |
| UserLatestLearnCourses | [必须] userId:用户ID [必须] count:课程数量,取值不能超过100 |
获取一个用户最近学习的课程列表 | |
| CourseLessons | [必须] courseId:课程ID [必须] count:课程数量,取值不能超过100 |
获取一个课程的课时列表 | |
| CourseThread | [必须] courseId:课程ID [必须] threadId:话题ID |
获取一个课程的一个话题对象 | |
| LatestCourseThreads | [必须] count:课程数量,取值不能超过100 [必须] courseId:课程ID |
获取一个课程最新发表的话题列表 | |
| ElitedCourseThreads | [必须] count:课程数量,取值不能超过100 [必须] courseId:课程ID |
获取一个课程的精选话题列表 | |
| LatestCourseQuestions | [必须] count:课程数量,取值不能超过100 [必须] courseId:课程ID |
获取一个课程最新发表的问答列表 | |
| ElitedCourseQuestions | [必须] count:课程数量,取值不能超过100 [必须] courseId:课程ID |
获取一个课程的精选问答列表 | |
| CourseReview | [必须] reviewId:评论ID | 获取一个课程评价对象 | |
| LatestCourseReviews |
[必须] count:课程评论数量,取值不能超过100 |
获取最新课程评论列表 | |
| TopRatingCourseReviews | [必须] count:课程评论数量,取值不能超过100 [可选] courseId:课程ID |
获取好评评论列表 | |
| Category | [必须] categoryId:分类ID | 获取一个分类对象 | |
| Categories | [必须] group:'course' 返回所有分类 | 获取所有分类 | |
| User | [必须] UserId:用户ID | 获取一个用户对象 | |
| LatestUsers | [必须] count:用户数量,取值不能超过100 | 获取最新用户列表 | |
| LatestLoginUsers | [必须] count:用户数量,取值不能超过100 | 获取最近登录的用户列表 | |
| LatestTeachers | [必须] count:用户数量,取值不能超过100 | 获取最新老师列表 | |
| RecommendTeachers | [必须] count:用户数量,取值不能超过100 | 获取推荐老师列表 | |
| HotGroup | [必须] count:小组数量,取值不能超过100 | 获取最热小组列表 | |
| HotThreads | [必须] count:话题数量,取值不能超过100 | 获取小组最热话题列表 | |
| PersonDynamic | [必须] count:动态数量,取值不能超过100 | 获取个人动态列表 | |
| LatestArticles | [必须] count:资讯数量,取值不能超过100 [可选] type:featured(是否头条);promoted(是否推荐);sticky(是否置顶) |
获取最新资讯列表 | |
| VipLevels | [必须] count:VIP数量,取值不能超过100 | 获取会员等级列表 | |
| Tags | [必须] count:标签数量,取值不能超过100 | 获取所有标签 | |
| TagsCourses | [必须] count:课程数量,取值不能超过100 [必须] tags:标签名称,以数组形式传入 array('默认标签') |
获取标签课程列表 | |
| Classrooms | [必须] count:班级数量,取值不能超过100 | 获取班级列表 |
如何使用课程列表数据?
循环遍历courses
<ul class="row">
{% for course in courses %}
<li class="col-sm-6 col-md-4 es-course-list">
<div>
<div class="course-top">
<img src="{{ file_path(course.largePicture, 'course-large.png') }}" class="img-responsive thumb">
</div>
<div class="course-bottom">
<h3>{{ course.title }}</h3>
<p class="metas clearfix">
{% if course.price > 0 %}
<span class="price-num">¥{{ course.price }}</span>
{% else %}
<span class="price-num">免费</span>
{% endif %}
{% if course.showStudentNumType == 'opened' %}
<span class="student-num">{{ course.studentNum }}人报名</span>
{% endif %}
</p>
<span class="nickname">
{% for teacher in course.teachers %}
{{ web_macro.user_link(teacher, 'text-muted') }}
{% endfor %}
</span>
</div>
</div>
</li>
{% endfor %}
</ul>