Showcase and discover digital art at yex

Follow Design Stacks

Subscribe to our free newsletter to get all our latest tutorials and articles delivered directly to your inbox!

Maintaining the special features

Maintaining the special features

Just how does Contribute add their special features? By applying a combination of advanced Dreamweaver template techniques with enhanced Contribute API JavaScript functions. Let’s take a closer look at how it all works together, so that you can understand how to modify the page better.

The listing of sites uses two conditional regions, an editable region and a repeating region, as you can see in this code (indentation added for clarification):

<!-- TemplateBeginIf cond="!HasSites" -->
   <a href="mmjs:CCWorkspaceManager.getManager(dw.getDocumentDOM())    .doWelcomePageStart();">
   <strong>Start editing</strong></a> pages on your website.
<!-- TemplateEndIf -->
<!-- TemplateBeginIf cond="HasSites" -->
   Start editing pages on your website:<br>
      <p style="margin-top: 0;">
         <!-- TemplateBeginRepeat name="Site" -->
            <!-- TemplateBeginEditable name="SiteName" -->
               Site name
            <!-- TemplateEndEditable -->
      <!-- TemplateEndRepeat -->
<!-- TemplateEndIf -->
The first conditional region displays a link to the My Connections dialog box if no connections have been created yet through an API call. The second conditional region appears if any connections have been created. Both conditional regions depend on a template parameter found in the <head> of the document called HasSites. Be sure to preserve this code when modifying the page:

<!-- TemplateParam name="HasSites" type="boolean" value="true" -->

Both the repeating and editable regions are contained within the second conditional region. Be careful not to alter the names of these regions: Site and SiteName, respectively. Modifying the names breaks the functionality.

The other unique feature on this page, the “Don’t show this page on startup” option, uses an internal cookie. When the user clicks the option, the cookie (dontshow) is set to either true or false. If the cookie is true, the Welcome page is bypassed and the initially declared connection is shown. The naming of the checkbox (dontShowCheckbox), as well as its onClick function call, is critical to keep if you want to maintain this option.

Should you not want to give your users the option of seeing the Welcome page, you’ll need to do more than just remove the form element containing the checkbox and all of its contents. If you look at the <body> tag, notice the onLoad event that calls initControls(). The initControls() function populates the checkbox in the Welcome page if the dontshow cookie is set. How do users show the Welcome page once they’ve opted not to see it? The page is displayed whenever they choose Help > Welcome. If you want to remove the “don’t show” option, be sure to also remove the onLoad event from the <body> tag and the initControls() function from the <head>.