In this blog post we’ll take a look at the little-used but incredibly-useful Book Reader Templates. These are not to be confused with Book Page Templates – although they are technically Book Page Templates themselves – just ones with a special purpose.
So, what are they used for? In short, a Book Reader Template controls the way in which non-native SAP Enable Now objects are displayed (or made available) in the Book Reader – and specifically within the context of a Book. These objects can be Word documents, PDFs, images, videos, audio files, or any other file type – effectively, anything that can be loaded into SAP Enable Now as a Media Object.
Let’s look at this by way of an example. Say I have a courseware presentation that has been developed as a Book with multiple Book Pages. I also have a pre-recorded video that I want to include within this presentation. I could create an additional Book Page for this, and insert the Video onto the Book Page using a Video Book Page object, but that means creating a new Book Page, adding a Media Object control to this, linking the actual video to this control, including any other information / formatting I want, and then publishing the Book Page and the video file. And I’ll need to do this every time I want to include a Media Object in my Book. It would be so much easier if I could just drop the video file into my Book in the Workarea, and it is automatically displayed the way I want it to be when the Book is displayed. That’s where Book Reader Templates come in.
So, for our simple (3-page) example, I have just added the Video Media Object (“Welcome” – highlighted below) directly to the Book, as shown in the following screenshot:
If you display the Book now, you will not see the Welcome video object during playback. (You also won’t see it in the Book Page Editor – and never will.) Whether it appears or not during playback is controlled by the Book Reader settings. These settings can be found under Playback Settings > book reader > Templates, as shown below:
For all objects except Groups, there are effectively two settings: Show {type} Object Properties, and Template for {type} Objects. The first of these must be selected if you want the object to be displayed in the Book Reader. The second specifies the Book Page Template to use when displaying the media object in the Book Reader. You must specify both of these settings.
So, let’s look at the Template. This is just a standard Book Page Template, but it must contain specifically-named placeholders for the media object and its properties to be displayed in. The following table lists the types of placeholders and their required object names for each Media Object type:
Note that doc covers Word documents and PDF files. Any other file types are covered by file.
Now let’s look at a simple Template that we can use – in this example, for Video Media Objects:
This Book Page Template contains Book Page objects named (1) caption, (2) shortdesc, (3) description, and (4) video (these are all highlighted in this example). At display time, these will be populated with (respectively) the Media Object (1) Name, (2) Short Description, (3) Description, and (4) contents. You can also add other objects to the Template, as required. In this example, I have added a header to match other Book Pages in the course, but you can also include buttons to play/stop the video, and so on – everything that you can normally do with Book Pages. Alternatively, you don’t have to include the caption, shortdesc, or description at all, if you don’t want these to be displayed. You could also resize the video (or image, doc, or file) object to take up the full Book Page area, if you want the Media Object to effectively be displayed full-screen.
So let’s look at how this Template is applied at display time. The screenshot below shows my example Book, with the second object in it (the video object named Welcome) displayed:
Here, you can see that the Book Page objects have now been replaced with the respective Media Object properties and contents – compare the information shown here with the metadata shown in the first screenshot, above. (For Audio objects, there is obviously nothing to display, and the audio file is played immediately.)
And that’s it! we now have a way of including Media Objects in our Books simply by inserting the Media Object file itself in our Book. There’s no need to define a ‘container Book Page’ – this will effectively be created automatically at display time, from the Template we specified.
Finally, as noted at the start, this only applies to Media Objects inserted into a Book. However, if you wanted to insert a Media Object into a Group, you can create a Book Page from the Book Reader Template defined above, and manually link the Media Object to the Book Page object.