Editing the Web Gallery Index Page

The following instructions are necessary only if you don't want to use an <iframe> to embed a Bridge web gallery into an existing page. They involve editing several parts of the gallery's index.html page to resize the Flash movie and add page elements of your own.

This isn't difficult, but you do need to follow the instructions very carefully. If you make a mistake editing the JavaScript sections, nothing is likely to work.

  1. Open index.html in the folder where Bridge created your gallery (in my case, it's kyoto/index.html).

  2. Save a copy of the file as index_orig.html. Close the copy. This is your backup in case you make any mistakes and need to start again.

  3. In Design view, index.html shows only a message that will be displayed to anyone who visits the page with JavaScript disabled. I'll leave you to make any changes to that message. The main part of the work needs to be done in Code view, so switch to Code view or Split view, and examine the code at the top of the page. It looks like this:

    Code at the top of index.html

    There are two things to notice here:

    • There is no DOCTYPE declaration. This is because the <style> block on lines 6–15 uses 100% height, which doesn't work with a DOCTYPE. You need to add a DOCTYPE to ensure that any CSS on your page is handled correctly.

    • The value that was entered in the Gallery Name field in the Bridge Output Module has been used for the page's <title>.

  4. Copy the DOCTYPE declaration from an existing page in your website, and paste it into index.html above all existing code.

  5. Amend the <title> to fit in with the rest of your website.

  6. Delete the <style> block shown on lines 6–15 of the preceding screenshot.

  7. Link your own style sheet to index.html. The code at the top of the page should now look similar to this:

    Amended code

  8. Scroll down the page until you locate the opening <body> tag. It should be around line 141 and look like this:

    <body><div align="center" style="width:100%; height:100%">

  9. Edit the <div> tag to remove the existing attributes. Replace them with an ID to identify the web gallery. You can use any name you like, except gallery. I suggest using webgallery like this:

    <body><div id="webgallery">

    Note: An ID should not contain any spaces or punctuation, except a hyphen or underscore. Nor should it begin with a number or a hyphen followed by a number. An ID should never be used more than once in the same page. The Adobe Output Module uses gallery as the ID of the Flash movie, which is why you can't use it for the <div>.

  10. Scroll further down the page until you locate the following section of code:

    Code for Flash movie

    This sets all the parameters for the Flash movie that displays the web gallery. As you can see on lines 184 and 185 of the preceding screenshot, width and height are both set to 100%. You need to change these values to suit your own site's layout.

    For my example page, I used the following:

    'width', '700px', 'height', '525px',

    Make sure you don't delete any of the quotes or commas. Also make sure there's no space between the number and px or %.

  11. Save index.html. That's all you need to edit. The Bridge web gallery has been successfully adapted to fit into an ordinary web page.

Of course, these edits on their own aren't sufficient. You need to build the structure of your own page around the <div> that contains the web gallery. However, a web gallery isn't going to need much more than your website branding (header, logo, etc.) and navigation.

For my example page, I floated the navigation menu left and put a wide left margin on the webgallery <div> to make room for it. The basic style rules are as simple as this:

#webgallery { margin:85px 10px 0 200px; } #nav { float:left; width:170px; margin:70px 10px auto 20px; }

If you want to use a table layout or need to move the <div>, put your cursor inside the message that's displayed to visitors with JavaScript disabled, and click <div#webgallery> in the Tag selector at the bottom of the Document window like this:

Tag selector

This selects the entire <div> which you can cut to your clipboard and then paste back into the new location. Be careful when pasting back. If the focus was in Design view when you cut the <div> to your clipboard, make sure you're in Design view when you paste. Alternatively, if the focus was in Code view, make sure you're in Code view—and in the right place—when you paste.

When you have finished, don't forget to upload the entire contents of the folder where the Adobe Output Module created the gallery.

See the finished example.

Back

Quick links to other pages of this tutorial

Saving the gallery to your site

Embedding the gallery index page

Editing the gallery index page

Books by David Powers

Dreamweaver CS5 with PHPGetting StartED with CSSEssential Guide to Dreamweaver CS4PHP Object Oriented SolutionsPHP Solutions