Creating a Dynamic Page in LDE


Overview

Based on your preference, you may like to show specific set of courses, elearning or knowledge categories in a dynamic page in your Learndot instance. 

Creating a Page to show All Learning Components in a Knowledge Category

To do this, please make the following changes:

  • Log into the Admin Dashboard
  • Navigate to System > Content > Pages
  • Click on the New button

  • Add the following details to the new created page
    • Enabled: Yes
    • Path: sample-page
    • Visible to: Everyone with the URL (or "Everyone" if you want it to be a public page)
    • Type: Content
    • Title: Page to show a Knowledge Category
    • Dynamic Heading: No
    • Use Title as Heading: Yes
    • Body: <code included below>
    • Dynamic Body: Yes

  • Save the change
  • To see what your page looks like, from the menu on the far right, click on Website under views on the right sidebar


Make sure your Knowledge Category has at lease one learning component (or you won't see anything on the page when testing)

Code to use for Body of Page

Change the name="Sample Training" to the name of a Knowledge Category in your system. i.e. name="TechSoft Training".


<h2>Show the Learning Components in a Knowledge Category</h2>
<p>sample text here</p>
<@s.getKnowledgeCategory var="category" name="Sample Training" />
<@s.getCourseEvents var="upcomingCourseEvents" maxResults=100 category=category>
 <table class="upcomingClasses">
 <tr>
 <th>
 Course
 </th>
 <th>
 Duration
 </th>
 <th>
 Date
 </th>
 <th>
 Location
 </th>
 <th style="width: 165px;">
 Register
 </th>
 </tr>
 <#list upcomingCourseEvents as courseEvent>
 <tr>
 <td>
 <a href="<@s.courseUrl course=courseEvent.course/>">${courseEvent.course.preferredName}</a>
 </td>
 <td>
 ${courseEvent.repeatDayCount} <#if courseEvent.repeatDayCount == 1>Day<#else>Days</#if>
 </td>
 <td>
 <a href="<@s.publicCourseEventUrl publicCourseEvent=courseEvent/>">${courseEvent.startTime?string("EEE, MMM d")}</a>
 </td>
 <td>
 <a href="<@s.locationUrl location=courseEvent.location/>">${courseEvent.location.name}</a>
 </td>
 <td>
 <a href="<@s.publicCourseEventUrl publicCourseEvent=courseEvent/>" class="pull-right btn btn-large btn-success">Register Now</a>
 </td>
 </tr>
 </#list>
 </table>
 
 </@s.getCourseEvents>