8 Replies Latest reply on Oct 22, 2006 11:28 AM by mikeyboy80

    Rollover Images and Server Side Includes

      Is there a way with Dreamweaver to have your menu block in a server side include file and have it function properly. I tried it and, maybe I wasn't holding my mouth right, but it didn't work. :-)
        • 1. Re: Rollover Images and Server Side Includes
          Level 1
          I forgot to say that I want my menu structure to use the Dreamweaver rollover images for its structure. See www.webs2impress.com/bridget for an example. I would like that menu block on the left to be in an include file.
          • 2. Re: Rollover Images and Server Side Includes
            mikeyboy80
            Depends what language you're progamming in.

            You'll need to use a preprocessed scripting language (PHP, ASP etc.) if you want to have a file like this.

            PHP:
            include("path_to_include.inc.php");

            ASP:
            <!--#include file="path_to_include.inc.asp"-->

            An alternative is to use Dreamweaver's template function, but once each page is actually created and saved into html files, if you need to make a change to the nav, you'll need to either manually alter each html file or edit the DW template and regenerate all the pages.
            • 3. Re: Rollover Images and Server Side Includes
              Level 1
              Thank you for your reply.

              I know php. Do I just construct the rollover menu and save it as a .php and then call it there? Do you have an example file you could send me\/
              • 4. Re: Rollover Images and Server Side Includes
                Level 7
                > An alternative is to use Dreamweaver's template function, but once each
                > page
                > is actually created and saved into html files, if you need to make a
                > change to
                > the nav, you'll need to either manually alter each html file or edit the
                > DW
                > template and regenerate all the pages.

                That's a misrepresentation of how Templates work (as I read it at least).
                If you make a change to the nav (assuming it's in the non-editable region
                like it should be), then all child pages will be automatically updated when
                you save the template. There's no "regeneration" involved, but you *do*
                have to upload all the changed pages. For this reason, I always put my
                navigation into server-side includes within the templates.

                If you are using Templates, you certainly wouldn't want to be manually
                editing each HTML file - which would mean that your template is not well
                designed.

                I find the use of both techniques together to be extremely useful.

                --
                Murray --- ICQ 71997575
                Adobe Community Expert
                (If you *MUST* email me, don't LAUGH when you do so!)
                ==================
                http://www.dreamweavermx-templates.com - Template Triage!
                http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
                ==================


                "mikeyboy80" <webforumsuser@macromedia.com> wrote in message
                news:ehfn3e$d4a$1@forums.macromedia.com...
                > Depends what language you're progamming in.
                >
                > You'll need to use a preprocessed scripting language (PHP, ASP etc.) if
                > you
                > want to have a file like this.
                >
                > PHP:
                > include("path_to_include.inc.php");
                >
                > ASP:
                > <!--#include file="path_to_include.inc.asp"-->
                >
                > An alternative is to use Dreamweaver's template function, but once each
                > page
                > is actually created and saved into html files, if you need to make a
                > change to
                > the nav, you'll need to either manually alter each html file or edit the
                > DW
                > template and regenerate all the pages.
                >


                • 5. Re: Rollover Images and Server Side Includes
                  Level 7
                  Yes.

                  The menu on this page is saved as a server-side include -

                  http://www.agexonline.com

                  like this -

                  <div id="bodyContent">
                  <?php include('includes/leftnav.php'); ?>
                  <div id="contentRight">

                  --
                  Murray --- ICQ 71997575
                  Adobe Community Expert
                  (If you *MUST* email me, don't LAUGH when you do so!)
                  ==================
                  http://www.dreamweavermx-templates.com - Template Triage!
                  http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                  http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                  http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
                  ==================


                  "annasue" <webforumsuser@macromedia.com> wrote in message
                  news:ehg7vs$1iv$1@forums.macromedia.com...
                  > Thank you for your reply.
                  >
                  > I know php. Do I just construct the rollover menu and save it as a .php
                  > and then call it there? Do you have an example file you could send me\/


                  • 6. Re: Rollover Images and Server Side Includes
                    mikeyboy80 Level 1
                    Probably the best thing to do would be to use Dreamweaver (Fireworks would be better, if you have it) to create the navigation. Copy the code that's output (Fireworks exports its HTML as tables - not sure how DW does it, I hand-code stuff in CSS - but you'll need all the info to do with the nav). Create a new file, select all, delete, then paste the code you copied. Save this file as nav.inc.php in a folder called 'scripts' (the extra .php is for security; it stops people being able to see into your code. If you just called it nav.inc, if they entered http://www.yoursite.com/scripts/nav.inc they'd be able to see everything that file contained, even php code. The .php part forces the php engine to parse the code, so all they'd see is the html table containing the nav).

                    If you're using tables, create an empty cell where you want the nav to go (or a <div> if you're using css) and put the following code:

                    <?php include("../scripts/nav.inc.php"); ?>

                    This will tell the page to look back outside its current directory, into the scripts directory, for a file called nav.inc.php - you are using structured directories, right? Cos putting everything at the root level's asking for trouble. I always split my files into relevant directories ('pix' for images; 'scripts' for include files, css and Javascript; 'main' for the homepage and the majority of other pages - the only file at root level is a php page with <?php header("Location: main/index.php"); ?> which fires the visitor straight to the correct homepage).

                    No reason why you should limit it to navigation; you can use include files for a huge variety of things (header graphics, page footers, recurring functions etc.).

                    Hope that's what you need - let me know if you have any probs.
                    • 7. Re: Rollover Images and Server Side Includes
                      Level 7
                      > Probably the best thing to do would be to use Dreamweaver (Fireworks would
                      > be
                      > better, if you have it) to create the navigation.

                      What? I'm sorry - but if you are referring to using FW HTML or pop-up menus,
                      then you are dead wrong. And if you hand code and use these things you
                      should really know better.

                      --
                      Murray --- ICQ 71997575
                      Adobe Community Expert
                      (If you *MUST* email me, don't LAUGH when you do so!)
                      ==================
                      http://www.dreamweavermx-templates.com - Template Triage!
                      http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                      http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                      http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
                      ==================


                      "mikeyboy80" <webforumsuser@macromedia.com> wrote in message
                      news:ehgb1b$4vi$1@forums.macromedia.com...
                      > Probably the best thing to do would be to use Dreamweaver (Fireworks would
                      > be
                      > better, if you have it) to create the navigation. Copy the code that's
                      > output
                      > (Fireworks exports its HTML as tables - not sure how DW does it, I
                      > hand-code
                      > stuff in CSS - but you'll need all the info to do with the nav). Create a
                      > new
                      > file, select all, delete, then paste the code you copied. Save this file
                      > as
                      > nav.inc.php in a folder called 'scripts' (the extra .php is for security;
                      > it
                      > stops people being able to see into your code. If you just called it
                      > nav.inc,
                      > if they entered http://www.yoursite.com/scripts/nav.inc they'd be able to
                      > see
                      > everything that file contained, even php code. The .php part forces the
                      > php
                      > engine to parse the code, so all they'd see is the html table containing
                      > the
                      > nav).
                      >
                      > If you're using tables, create an empty cell where you want the nav to go
                      > (or
                      > a <div> if you're using css) and put the following code:
                      >
                      > <?php include("../scripts/nav.inc.php"); ?>
                      >
                      > This will tell the page to look back outside its current directory, into
                      > the
                      > scripts directory, for a file called nav.inc.php - you are using
                      > structured directories, right? Cos putting everything at the root level's
                      > asking for trouble. I always split my files into relevant
                      > directories
                      > ('pix' for images; 'scripts' for include files, css and Javascript; 'main'
                      > for
                      > the homepage and the majority of other pages - the only file at root level
                      > is a
                      > php page with <?php header("Location: main/index.php"); ?> which fires the
                      > visitor straight to the correct homepage).
                      >
                      > No reason why you should limit it to navigation; you can use include files
                      > for
                      > a huge variety of things (header graphics, page footers, recurring
                      > functions
                      > etc.).
                      >
                      > Hope that's what you need - let me know if you have any probs.
                      >


                      • 8. Re: Rollover Images and Server Side Includes
                        mikeyboy80 Level 1
                        OK, that particular piece of advice is wrong. Forgive me.

                        I've never used Dreamweaver's menu creation facility, so my comment was based solely on experience at work - if we're creating an image-based menu with rollover behaviours then we use Fireworks. However, Fireworks' JavaScript-based rollover behaviour is an absolute pig.

                        Personally I prefer CSS-based rollover effects, which I hand-code. If I use images, I keep them minimal; I don't like having to make the user wait until the image has downloaded before they'll be able to navigate the site properly.

                        I've only started using Dreamweaver relatively recently - we were forced to use Homesite at work until a couple of months ago - so I've not had the time I'd like to get used to some of the less immediate features.

                        So while that part of my reply may have been misinformed, the remainder (the majority, in fact) should be a little more accurate, and I hope it proves useful to the topic starter.