Embedding Course Details in your Web Pages

Although the onCourse web site automatically generates pages for each course and class, plus tag-based navigation through them, sometimes you want to put information about a course somewhere else on your site. Maybe you want to show a teaser to a random course on your home page, but only if it is tagged with the “New Courses” tag. Maybe you want to add a teaser to a random course in the sidebar, but the course has to match what the user last searched for and it has to have current classes. Maybe you’d like to insert the full detail text of a particular course in another page.

The simple way to do all of these is to use the {course…} rich text markup in the detail content of a web page or a web block.

Markup Syntax

An example might be:

{course template:“Course with Intro” tag:”/Subjects/Work” current:“true” search:“false” }

The parameters are as follows:

template – the name of the Template used to display the course (see below for description of templates). If not specified (or if a template with this name is not found), it will display the title of the course as a link to its details page.

code – if specified, only the course with that code will be displayed. Otherwise, a random course will be displayed. If you use a class code, the course for that class will be displayed.

tag – if specified, the random choice is restricted to courses with this tag.

current – if true, the random choice is restricted to courses that have classes that are not yet finished.

search – if true, the random choice is restricted to courses in the current advanced search results. If there is no current search, or there are no advanced search parameters, this will be ignored.

Templates

Once this {course} markup has decided which course to display, that course can be displayed any way you like, because the output of this markup is determined by the template that you specified. Each template can display any text, plus any details about the course, plus many other powerful web components used elsewhere in the onCourse web site. It could be as simple as the title of the course, linking to the course detail page. Or it could be a nice box with rounded corners, with the title of the course, the first 100 characters of its detail text, and a “more info…” link. It could even list all the current classes for that course with links to their detail pages.

You can have as many different templates as you want, customising the display of each {course} markup you use.

At the moment these templates can only be configured by ish, so if you want to use templates, please contact us to find out what is possible.