Introduction
The Course Description Feeds application provides a simple way to include the most up-to-date course information on a University website. This application allows course descriptions from the Registrar (which are searchable and accessed when students peruse the University Class Schedule) to be displayed on individual webpages; once updates are made to the UIS data, these updates will automatically show up on websites that use Course Description Feeds.
Note that updating the Registrar's Course Description database is an entirely separate process.
Setting up a Course Feeds directory
Overview
The first step is to create a Course Feeds directory to place your Course Feeds data. To do so, simply fill out the online request form; Webmaster support will then perform the setup for you and contact you with additional details. A detailed explanation of the setup process is provided for your perusal; however, no additional work is required on your part for this step.
Behind the Scenes
Upon receiving your request, Webmaster support will create a series of subdirectories in your departmental website:
- A subdirectory "
course-feeds" (e.g., http://www.bu.edu/history/course-feeds/).
- A subdirectory "
course-feeds/templates" (e.g., http://www.bu.edu/history/course-feeds/templates/).
- A subdirectory "
course-feeds/output". (e.g., http://www.bu.edu/history/course-feeds/output/)
These subdirectories are used by the Course Descriptions Feeds (hereafter "CD Feed") application and should not be deleted, moved or renamed. Doing so will break your department's CD Feed and will require manual intervention to correct any changes. In the event that you would like these directories located in a specific area of your website, please indicate this in your request.
In addition to creating these directories, Webmaster will make the course-feeds/output writeable by the webserver (specifically, the cwis-secure and nisadmin:cron-users AFS groups). Again, please note that deleting, moving or renaming these directories will break your department's CD Feed and should thus be avoided. In the event that you accidentally make any of the above alterations, please contact Webmaster to request assistance.
Creating Containers and Templates
Overview
This step should take place only after your department's course-feeds directory has been created and a notification received from Webmaster suppport. It creates two files or sets of files: the Course Container (.CFT), which determines what courses are displayed, and the Course Template (.html), which determines how the course feed data is displayed.
Creating a Course Container file
The Course Container file specifies which courses you would like to see in your CD Feed. This file should have a name ending with ".CFT" (e.g, "history.cft") and be placed in your course-feeds directory (e.g., http://www.bu.edu/history/course-feeds/). If you would like to have multiple CD Feeds, simply create a Course Container file (hereafter .CFT) for each feed. You can create a .CFT file using any text editor, such as Windows Notepad or OS/X TextEdit.
Tip: Choose an intuitive name for your .CFT file, such as "undergraduate.cft" for your department's undergraduate courses, or "armenian.cft" for Armenian Studies courses.
Contents
A .CFT file consits of two custom tags and (optional) HTML. These tags are: the <bub_base> tag, which names the file that will contain your CD Feed, and the <bub_course> tag, which selects the courses contained in your CD Feed. Both the <bub_base> and <bub_course> tags must be included in your .CFT file.
<bub_base>
The <bub_base> tag has three basic functions: it states where your CD Feed files will go, how they will appear, and - in very broad terms - what types of courses to display or exclude.
The output attribute is the most basic attribute of the <bub_base> tag: it specifies where your CF Feed file will be produced. charset indicates the character set used in the CD Feed files; by default, this is "latin1", the same as a standard webpage, but can be changed to match the character set used in your website. Other (optional) attributes are included below; note that you must include an output attribute in your <bub_base> tag. All other attributes are optional.
Full List of Possible <bub_base> Attributes
| Attribute |
Description |
Sample Value |
| blank_titles |
Indicates whether to include courses that have blank titles (and usually blank descriptions). Can be Y (default) or N. |
"Y" |
charset |
Character set of the output, using MySQL syntax. Default is "latin1" |
"utf8" |
output |
File to write resulting output to. This should indicate a file within course-feeds/output, preferably with a name ending in ".html". |
"com.html" |
| semester |
Restricts course listings to a particular semester. Required if show_sections="Y" or show_unscheduled_courses="Y". The first four digits must be the semester code: FALL, SPRG, SUM1, SUM2, or SUMM (which will return courses in both SUM1 and SUM2). The last four digits must be the calendar year. |
"FALL2007" |
| show_sections |
Whether to show section and schedule information in addition to course descriptions. Can be Y or N (default). |
"Y" |
| show_unscheduled_courses |
Whether to include courses that have no sections scheduled in the specified semester. Can be Y (default) or N. |
"Y" |
| template |
Specifies a template file to be used when formatting CD Feed data. This should indicate a file within course-feeds/templates. See below for additional information. |
"history.tpl" or "com.html" |
| terms |
Whether to include summer-term courses and descriptions. Can be one of: regular (default), summer, or all. |
"regular" |
Examples
<bub_base output="undergraduate.html">
This code specifies an output file "undergraduate.html", with the default "latin1" character set. Because this uses the default "latin1" character set, there is no visible charset attribute. It will show all courses that fit the requirements outlined in the <bub_course> tag (see below).
<bub_base output="all.html" charset="utf8">
This code specifies an output file "all.html", with the "utf8" character set. It will show all courses that fit the requirements outlined in the <bub_course> tag.
<bub_base output="all.html" charset="utf8" semester="FALL2008" show_sections="Y" show_unscheduled_course="N">
This code specifies an output file "all.html", with the "utf8" character set. Additionally, it indicates to show all courses scheduled for the Fall 2008 semester, showing section and schedule information, and omitting any courses which aren't scheduled for this semester. These courses are drawn from pool of courses specified in the <bub_course> tag.
<bub_course>
The <bub_course> tag specifies what courses to include or exclude courses from your CD Feed. Its properties do not specify scheduling information (e.g., whether a course is being offered) - this is set by the <bub_base> tag. To specify several sets of courses to be included in your CD Feed, you can add more than one <bub_course> tag to your .CFT file.
The <bub_course> tag must contain either an "id" attribute or both a "college" and a "department"
attribute.
| Attribute |
Description |
Sample Value |
| college |
Specifies courses to display; required if using department. Unlike id, this cannot be a list (e.g., college="CAS,CFA" is not valid.) |
"COM" |
| department |
Specifies courses to display; required if using college. Unlike id, this cannot be a list (e.g., department="AR,MU" is not valid.) |
"CO" |
| except |
Specifies course(s) to exclude from listing. Can be one or more courses or ranges, in the same format as id. |
"COMCM301" , "COMCM301-COMCM350", "COMCM301, COMCM302, COMCM305", "COMCM301, COMCM320-COMCM350" |
| id |
Specifies course(s) to display. Can be one or more courses or ranges. Overrides college/department. |
"COMCM301" , "COMCM301-COMCM350", "COMCM301, COMCM302, COMCM305", "COMCM301, COMCM320-COMCM350" |
| template |
Specifies a template file to be used when formatting CD Feed data. This should indicate a file within course-feeds/templates. See below for additional information. |
"history.tpl" or "com.html" |
Note that you can include a template file in both the <bub_base> and <bub_course> tags. This allows one to have the courses indicated in one <bub_course> tag (e.g., classes outside your department) displayed differently than those indicated in another tag.
Hint: When adding multiple <bub_course> tags, some <bub_base> attributes (e.g., "show_unscheduled_courses") can be used inside a <bub_course> tag to override the defaults set in <bub_base> .
Examples
<bub_course id="CASHI100-599">
This code selects all CAS History courses with numbers in-between 100 and 599 (i.e., all undergraduate courses). Note that it does not specify an output template.
<bub_course template="history.tpl" id="CASHI100-599, CASAN550">
This code adds an output template and selects all CAS History courses with numbers in-between 100 and 599, adding also CAS Anthropology 550. An example usage would be to include courses of interest in another department.
<bub_course template="history.tpl" id="CASHI100-599, CASAN550" except="CASHI112">
This code adds an output template and selects all CAS History courses with numbers in-between 100 and 599, adding also CAS Anthropology 550, but excluding CAS HI112. An example usage of "except" would be to exclude courses offered to non-majors that cannot be taken for credit by majors.
Complete Examples
You can peruse the following examples of complete Course Container (.CFT) files:
For a broader set of examples, please see the detailed supplemental section.
Creating a Course Template file
Overview
Course Templates determine both the layout and content (information included) of individual course entries in your CD Feeds. You can create a single template file to control how all of your CD Feed data displays, or create multiple template files for multiple feeds, or to differentiate groups of courses within a feed. Templates can be referenced both in the <bub_base> and <bub_course> tags of the Course Container (.CDF) file.
Creating
You can create a course template file with any name; however, the recommended format is to use an .html document for your course template. You can create the starting .html document using any web editor (e.g., Dreamweaver), making sure to match the HTML format (e.g., XHTML Transitional 1.0) used by your website. Any Course Template file that you create should be located in course-feeds/templates.
Contents
Course Template files (hereafter "CTF"s) use a PHP-style syntax to indicate where the different data fields from course descriptions should go. This syntax {!element!} identifes a named element (e.g., "college", "department", or "title") within {! and !}; the {!element!} in the template is then replaced by the corresponding data when your Course Description Feed is produced.
Complete List of Course Template Elements
| Element |
Description |
Sample Output |
| {!college!} |
Three letter college ID |
"COM" |
| {!department!} |
Two letter department ID |
"JO" |
| {!course_num!} |
Three number course ID |
"411" |
| {!title!} |
Full title of course |
"Professional Journalism Internship" |
| {!prereq_u_form!} |
Undergrad course prerequisites |
"(COMJO307 & COMJO308)" |
| {!prereq_u_desc!} |
Undergrad non-course prerequisites |
"Must be a junior or senior." |
| {!prereq_u!} |
Combination of both undergraduate course and non-course prerequisites |
"Prereq: COM JO 307 and COM JO 308; must be a junior or senior." |
| {!prereq_g_form!} |
Graduate prerequisite courses |
"(COMJO308)" |
| {!prereq_g_desc!} |
Graduate non-course prerequisites |
"Must have completed qualifying exams." |
| {!prereq_g!} |
Combination of both graduate course and non-course prerequisites |
"Grad Prereq: COM JO 308; Must have completed qualifying examsr." |
| {!coreq_u_form!} |
Undergrad co-requisite courses |
Same as prereq_u_form, but displays co-requisite information. |
| {!coreq_u_desc!} |
Undergrad non-course co-requisites |
Same as prereq_u_desc, but displays co-requisite information. |
| {!coreq_u!} |
Combination of both undergraduate course and non-course co-requisites |
Same as prereq_u, but displays co-requisite information. |
| {!coreq_g_form!} |
Graduate course co-requisites |
Same as prereq_u_form, but displays co-requisite information. |
| {!coreq_g_desc!} |
Graduate non-course co-requisites |
Same as prereq_u_desc, but displays co-requisite information. |
| {!coreq_g!} |
Combination of both graduate course and non-course co-requisites |
Same as prereq_u, but displays co-requisite information. |
| {!instructor!} |
Names of all instructors |
"Daniel Segre and Calin Belta" |
| {!credits!} |
Number of credits |
"4"; can also be "Var" |
| {!offered!} |
Semester course appears; can be ongoing |
"2nd sem." |
| {!description!} |
Written description of class. |
"A course in advanced photography for ..." |
| {!course_link!} |
Link to course information, if any (same as Bulletin). |
"http://www.bu.edu/htbin/class.pl?hc= %23CC3333&t=COM+JO+411+ Professional+Journalism+Internship" |
You can use additional text or HTML code in your CTF file to format the CD Feed; this is especially useful when integrating the CD Feed into a website. For example, your template could include the following code:
<div class="titles">{!title!}</div>
Because the {!title!} element is enclosed in a <div> tag with the class "titles", if your webpage includes a CSS style "titles", any course titles in your CD Feed will automatically use this style information. Advanced users can also create their own customized template elements.
Note that not all course descriptions include data in each of the above fields.
Example
<div class="course_title">{!department!} {!course_num!} - {!title!}</div>
<div class="course_description">
{!description!} <strong>{!credits!}</strong>
</div>
This example code displays the department (in two letter format), course number and title together in a single <div> tag (so that they're styled as a single element). The course description is placed in a <div> tag of its own, with the number of credits indicated at the end in boldface (<strong>). This code produces HTML output such as the following:
<div class="course_title">FT 314 - Writing for Television</div>
<div class="course_description">
Required of all students in the Television Program. The theories
and techniques underlying writing for the principal radio and
television forms. Emphasis is on the relationship between writing
and production, establishing sound aesthetic bases for all broadcast
writing, and the writer's social and ethical responsibilities.
Weekly writing assignments, lectures, and critiques. May be taken
sophomore year. <strong>4 cr.</strong>
</div>
Any data fields that are not specifically identified in your CTF file will not be displayed.
Including the Course Feed in a Website
Once your course-feed directories, Course Container files and Course Template files have been created, you are ready to add your finished Course Description feed to a website. If you wish to preview your output, you can do so using the CD Feed Preview tool. Note that your CD feed will automatically update on a weekly basis, but that you can always manually update your feed using the CD Feed Preview tool's "Publish" option.
Overview
The Course Description Feeds application uses your Course Container and Course Template files to produce output files that can be used in any HTML page. The names of your output files are specified in the output attribute of your Course Container (CTF) file and are located in your course-feeds/output directory. These output files can be included into your website as server-side includes (SSI files). The easiest method of enabling SSIs is to rename any .html files to use the .shtml extension; additional details can be found in our Enabling SSI tutorial.
Specifics
Once you have enabled server-side includes for your web page(s), you can include a course description by adding the following line to your web page's source code:
<!--#include virtual="/your-path/course-feeds/output/file.html" >
Make sure to replace "your-path" with the correct location of your course-feeds directory (normally your department's top-level web directory) and "file.html" with the name of the output file which you wish to include:
<!--#include virtual="/history/course-feeds/output/undergraduate.html" >
The name of the output file is specified in your Course Container (CTF) file's output attribute.
Reminder: Contact Webmaster support to have your course-feeds directory setup for use with Course Description Feeds. Although you can create the required directories yourself, the Webmaster support staff will need to setup special access permissions for the application to work.
Supplement: Examples
Basic Examples
Example 1: All COM Communications courses.
Example 2: All CAS Philosophy courses from Fall 2007.
Example 3: All CFA Music and Art courses, with separate output templates.
Example 4: All CAS Computer Science courses offered in Fall 2006, including section and schedule information.
Advanced Examples
Templates in Action: BU Bulletins
There are many different template options available when using Course Description Feeds. Several of these examples are illustrated below, using a page from the BU Bulletins site as an example.
The original BU Bulletins site was created by hand, manually copying course description entries from the printed media and converting them into HTML. (Our example page deliberately mimics the appearance of the original, printed media.) Besides the initial investment in time to create these pages, in the example given here must be updated manually; there is no connection to the Course Description data maintained by the Registrar. To set the course descriptions in this page, there are several options available:
- Use an unstylized, raw course descriptions feed (Not Recommended).
- Use a course description template that mimics the HTML code used in the existing site. (Recommended when using existing CSS)
- Use a course description template that incorporates <div> tags to style the Course Descriptions Feed. Styling can be used to mimic the appearance of the current page, if desired. (Recommended when adding new CSS)
Option #1, which simply transmits all of the information with no formatting, is only useful in very rare circumstances. Option #2 is useful for quickly integrating a CD Feed into an existing site. Option #3 initially produces the same results as Option #2, but provides the necessary tags to add additional CSS styles. An existing template can always be modified to switch from one option to another.
A full selection of relevant files is available for your perusal:
| |
Original Page |
Raw CD Feed |
HTML-Mimiced CD Feed |
Div-tagged/styled CD Feed |
Course Container |
- |
|
|
|
Course Template |
- |
|
|
|
Output |
- |
|
|
|
Webpage |
|
|
|
|
Advanced Supplement: Creating Custom Template Elements
In addition to all the attributes outlined in the Course Container File and Course Template sections, you may also include fields that not included in the available data.
By creating elements that begin with my_, such as my_language or my_lab, you can generate new attributes for use in the bub_base or bub_course tags. These attributes become template variables bearing the same name as the attributes.
Including a my_ attribute in your container template and a corresponding my_ element in your course template allows you to insert new information into your output.
If you are adding a my_ attribute to a bub_course tag that returns multiple courses, you may also
include an include_my_ attribute with the same suffix as the my_ attribute to indicate which courses the attribute
should apply to. If this attribute is omitted, the my_ attribute will be applied to all courses that the bub_course tag
returns; if it's included, it will only show up for those courses. The include_my_ attribute takes a course list formatted in the same way
as the id attribute for the bub_course tag (e.g. "CASPO101, CASPO201-CASPO300").
Sample Attribute
If, for example, you wanted to indicate that certain classes were counted as lab courses, you could create a variable called my_lab. The value of my_lab would be set in the container template.
Container Template
<bub_base template="com.tpl" output="COM-CO">
<bub_course id="COMCO101" my_lab="This is a lab course.">
<bub_course id="COMCO102" my_lab="">
<bub_course id="COMCO301-COMCO999" my_lab="(LAB)"
include_my_lab="COMCO501-COMCO599">
Now, you need to create an {!element!} in your course template to output the contents of my_lab. This element should have the same name as your new attribute.
Course Template
{!college!} {!department!} {!course_num!}
{!title!}. {!my_lab!}
The output on your course description page will render all the precoded attributes and your new attribute, my_lab.
Resulting Output
COM CO 101
Way of the Wrld. This is a lab course.
COM CO 201
Introduction to Communication Writing.
COM CO 350
Mass Media in Australia.
COM CO 401
Radio Station Practicum.
COM CO 452
Pol Camp & Comm.
COM CO 500
Directed Study.
COM CO 510
Special Topics. (LAB)
COM CO 523
Comm Structures. (LAB)
COM CO 525
Writing About Society. (LAB)
COM CO 561
Camp&Comm US&Uk. (LAB)
COM CO 570
Special Topics: The Comment Workshop. (LAB)
COM CO 599
COM Internship. (LAB)
COM CO 700
Fin & Strat Mng.
COM CO 704
Teaching Techniques.
COM CO 990
Continuing Stdy.
Advanced Supplement: Section and Schedule Information
Section and schedule information can be included for scheduled courses by including the attribute show_sections="Y" specified in your course container's bub_course or bub_base tag. You can indicate whether to include or exclude unscheduled courses by using the show_unscheduled_courses attribute (see the course container section for details). If you do include section and schedule data, you must set the semester in the bub_base tag - otherwise, the system won't know which semester's sections to show.
Once you instruct the system to retrieve section information, it can be included in the course template by using a set of section_block tags within the course description, like so:
<!-- BEGIN section_block -->
{!section_name!}
<br />
<!-- END section_block -->
Creating a section block will display each section (A1, B1, etc.) of the course or display nothing if no sections are scheduled. The section_block block only contains information about the section name and instructor. In order to display the times and locations, a schedule_block needs to be created inside of the section_block. For example:
<!-- BEGIN section_block -->
{!section_name!}
<ul>
<!-- BEGIN section_block -->
<li>{!schedule_days!} {!schedule_time_start!}-{!schedule_time_end!}</li>
<!-- END schedule_block -->
</ul>
<!-- END section_block -->
The reason for the block structure is that a course can have multiple sections, and a section can have multiple schedules. As with the course templates, you can mix and match special variables (described below) and arbitrary HTML; each block will be parsed once for each section or schedule. The following special variables can be used in section or schedule blocks:
Section Block Template Elements
| Element |
Description |
Sample Output |
| section_name |
Letter/number section code |
"A1" |
| section_title_abbrev |
Abbreviated section title |
"JO INTERNSHIP" |
| section_instructor_uc |
Last name of instructor, in caps |
"KLARFELD" |
| section_instructor |
Last name of instructor |
"Klarfeld" |
Schedule Block Template Elements
| Element |
Description |
Sample Output |
| schedule_class_type |
Type of class, written fully |
"Independent" |
| schedule_class_type_abbrev |
Type of class, abbreviated |
"IND" |
| schedule_building |
Three letter building code |
"SAR" |
| schedule_room |
Room number |
"218" |
| schedule_days |
Days of section, as single letters |
"MW" |
| schedule_days_1 |
Days of section, as single letters separated by a comma |
"M, W" |
| schedule_days_3 |
Days of section, as three letters |
"Mon, Wed" |
| schedule_days_full |
Days of section, written fully |
"Monday, Wednesday" |
| schedule_time_start |
Start time |
"6:00 PM" |
| schedule_time_end |
End time |
"7:30 PM" |
| schedule_time_start_24 |
Start time written in military time |
"18:00" |
| schedule_time_end_24 |
End time written in military time |
"19:30" |
Below is a sample course description template that uses both the "section_block" and "schedule_block" tags. For readability's sake, this example omits HTML markup; in a production environment, you would probably style the fields below to make them appear like you want them to.
{!college!} {!department!} {!course_num!} - {!title!}
-----------------------------------------------------
<!-- BEGIN section_block -->
section: {!section_name!}
instructor: {!section_instructor!}
meets:
<!-- BEGIN schedule_block -->
{!schedule_days!} {!schedule_time_start!}-{!schedule_time_end!}
({!schedule_building!} {!schedule_room!})
<!-- END schedule_block -->
<!-- END section_block -->
This template will be parsed to produce something like:
COM FT 310 - Screenwriting I
-----------------------------------------------------
section: A1
instructor: Tba
meets:
M 2:00 PM-4:30 PM
(SAR 218)
F 1:30 PM-3:00 PM
(COM 213)
section: B1
instructor: Tba
meets:
W 2:00 PM-4:30 PM
(CAS B18A)
F 1:30 PM-3:00 PM
(GCB 203)
section: C1
instructor: Thompson
meets:
F 10:00 AM-12:30 PM
(KCB 107)
F 1:30 PM-3:00 PM
(KCB 103)
Note that the section and schedule blocks are repeated in the output, despite appearing in the template only once.
Questions
Questions about Course Description Feeds? You can contact Webmaster Support for assistance by filling out our help form.
|