9 Replies Latest reply: Jan 2, 2010 1:42 PM by Nick Entin RSS

    CSS question

    lifeguardlloyd Community Member

      Is it possible to have the text content of say a nav bar imbedded in css? This way if you change the text it updates on all the pages.

       

      LP

        • 1. Re: CSS question
          pziecina CommunityMVP

          Hi

           

          You could use the css content declaration, but as this will not work in IE it is not usable for such items.

           

          The only other alternative is to externalize the menu and then use ssi's to include it.

          See - http://www.w3schools.com/PHP/php_includes.asp

           

          PZ

          • 2. Re: CSS question
            khaledgar Community Member

            Well you should wait some time for CSS 3 to be fully supported most of the time you will

            be waiting for IE to support it because other browser like safari and firefox has done their home work

            for the navigation you can use php as the prvious reply manchine

             

            for example you have

            <ul>

                 <il><a href="#">home</a>

                 <il><a href="#">about us</a>

                 <il><a href="#">contact</a>

                 <il><a href="#">services</a>

            </ul>

             

            cut this code from all of your pages and raplace it with:

             

            assuming you put the navigation unordred list in a file called "navigation.php"

             

            <?php include("navigation.php");?>

             

            but you should put it in the smae place as ur html for the navigation was for avoiding mess up with your layout

             

            you can do the same for all your repeating items:

            like footer, header maybe if you have the same in all the pages

            • 3. Re: CSS question
              Nancy O. CommunityMVP

              Personally, I use Server-side Includes (SSIs) for repeating page elements suchas headers, footers and navigation menus.  Some people useDW Templates (.dwt files).  The nice thing about using SSIs is that you only need to edit and upload one file.

               

              Guidance  on when to use DW Templates, Library Items and Server-Side Includes -
              http://www.adobe.com/devnet/dreamweaver/articles/ssi_lbi_template.html

               

              More on DW Templates and SSIs:
              http://www.smartwebby.com/web_site_design/dreamweaver_template.asp
              http://www.smartwebby.com/web_site_design/server_side_includes.asp

               

               

              Nancy O.
              Alt-Web Design & Publishing
              Web | Graphics | Print | Media  Specialists
              www.alt-web.com/
              www.twitter.com/altweb
              www.alt-web.blogspot.com

              • 4. Re: CSS question
                Nick Entin Community Member

                One way you could do it is to use javascript.

                 

                Just make a javascript file with a document.write for each of your menu bar items.

                 

                Then on each of your pages place the external javascript link. When you change your javascript file, each page will change.

                 

                Nick

                • 5. Re: CSS question
                  lifeguardlloyd Community Member

                  Whew! All the answers are fabulous. I will need to ponder each one and

                  decide. My employer uses Java Script. I'll investigate each option. Thank you all!

                   

                  LP

                  • 6. Re: CSS question
                    David_Powers CommunityMVP

                    Using JavaScript to generate site navigation is a very bad idea. Not only will it fail when someone visits the website with JavaScript disabled in the browser, more importantly, it will result in search engines failing to index the site. Search engines don't follow links in JavaScript.

                     

                    There's nothing wrong in using JavaScript to animate navigation menus (such as flyouts or tree menus), but the links themselves should always be in HTML.

                    • 7. Re: CSS question
                      mhollis55 CommunityMVP

                      Frankly, I like Nancy's first option; templates.

                       

                      Templates can give you the ability of using one, two or three stylesheets for your entire website. They can also allow you to use one form for everything you re-use and these tend to include navigation, footer information, header graphic and, in some cases, sidebars.

                       

                      Some of my sites use one template for all pages and that template uses two or three stylesheets -- one for navigation, one for the main body and one stylesheet for additional materials for pages that, due to their content, need to be set up significantly different from the rest (for example a slide show or a special coupon).

                       

                      I may choose to make the first page of the website a little different from the rest and I won't template that, but it will follow a general style and its stylesheet will be very close to the rest of the pages, perhaps with three columns instead of two, a larger header or a special "welcome" area.

                       

                      If you update navigation in a template, Dreamweaver will ask you if you want to update all pages associated with that template. You will, of course, answer "yes." Then testing is a snap. Just check the template itself and you will see your changes to your navigation and be able to verify the links very quickly.

                      • 8. Re: CSS question
                        khaledgar Community Member

                        well with javascript you will have to write a bunch of lines of code in each page

                        • 9. Re: CSS question
                          Nick Entin Community Member

                          khaledgar wrote:

                           

                          well with javascript you will have to write a bunch of lines of code in each page

                          <script type="text/javascript" src="navbar.js"></script>

                           

                          Not that much code.

                           

                          Nick