Back to Top
The nuts and bolts for
Creative web development

TSS in template based page

Question:
I would like to run a slide show on a template based page, but I don't know how to incorporate Trans Slide Show on a template based page.
Answer:
There are several ways to handle this:

** number 1 (the simple way) **

The Trans Slide Show extension needs you to apply 1 or 2 behaviors to the page:

  1. The 'Init' behavior which would usually be applied to the onLoad event of the BODY tag
  2. Optionally, if not using the auto-play feature in the 'Init' behavior, the 'Play' behavior, which would be applied to images or links to control going to the next/previous slide.

However, instead of applying the 'Init' behavior to the onLoad event of the BODY tag, you can apply it e.g. to the onLoad event for some IMG tag on your page (and thus not to the BODY tag).
Do NOT apply the behavior to the slide show base image itself, because then the show will not run correctly.

** number 2 (this is the more generic solution) **

What I often do in this type of situation is add a standard function call to the BODY tag in the template and put extra behavior calls in that standard function on pages that need extra functionality.

In the head section of the template page I put an editable region which looks something like:

<!-- #BeginEditable "extraScripts" -->
    <script type="text/javascript" language="JavaScript">
    <!--
    function onLoadExtras() {
        return;
    }
    //-->
    </script>
<!-- #EndEditable -->


And I make the BODY tag in the template look something like this:

<body onload="onLoadExtras();">

And then I add stuff to the onLoadExtras() function in the head where necessary. In this case that would be the 'Trans Slide Show - Init' behavior function call.

Marja Ribbers-de Vroed

Marja Ribbers-de VroedWell, what's there to tell?

I worked as a software engineer for a well-known Dutch software company for about 10 years. But then I decided I did not want to work there anymore.
Since then, I've been working with my husband in our own company.

I "discovered" web development early 2000, and I soon found out that I could actually create my own extra (DHTML) features in Dreamweaver by building custom extensions.
My first extension was Cross-browser AutoScroller, but I've developed several other ones since then.

See All Postings From Marja Ribbers-de Vroed >>

Share this Article