how to make website wide changes, later

Discussion in 'HTML' started by someone_else, Nov 1, 2008.

  1. someone_else

    someone_else Guest

    hi all,
    I want to build a website where each page contains a common set of links to
    other pages in the site. However, when I add a link, at a later date, I
    don't want to have to add it manually to each page.

    I have a rudimentary understanding of CSS, but I can't figure out how to use
    it to create my basic page template, which contains the common links.

    I'm sure I must be missing something very obvious.
    Any simple examples out there?
    cheers
     
    someone_else, Nov 1, 2008
    #1
    1. Advertising

  2. Gazing into my crystal ball I observed "someone_else"
    <> writing in
    news:490c9189$:

    > hi all,
    > I want to build a website where each page contains a common set of
    > links to other pages in the site. However, when I add a link, at a
    > later date, I don't want to have to add it manually to each page.
    >
    > I have a rudimentary understanding of CSS, but I can't figure out how
    > to use it to create my basic page template, which contains the common
    > links.
    >
    > I'm sure I must be missing something very obvious.
    > Any simple examples out there?
    > cheers
    >
    >
    >


    You want to look into some sort of server side include, depending on
    what language your hosting provider has available. For example

    <?php include = "nav_inc.php"; ?>
    or
    <!--#include file = "nav_inc.asp"-->

    --
    Adrienne Boswell at Home
    Arbpen Web Site Design Services
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
     
    Adrienne Boswell, Nov 1, 2008
    #2
    1. Advertising

  3. On 2008-11-01, someone_else wrote:
    > hi all,
    > I want to build a website where each page contains a common set of links to
    > other pages in the site. However, when I add a link, at a later date, I
    > don't want to have to add it manually to each page.
    >
    > I have a rudimentary understanding of CSS, but I can't figure out how to use
    > it to create my basic page template, which contains the common links.


    You don't use CSS; that is for presentation, not content.

    > I'm sure I must be missing something very obvious.
    > Any simple examples out there?


    Use server-side includes (SSI):

    <!--#include file="links.html" -->

    You may have to name the enclosing file with a .shtml suffix or set
    the execute bit on it, depending on how your web server is set up.

    --
    Chris F.A. Johnson, webmaster <http://Woodbine-Gerrard.com>
    ===================================================================
    Author:
    Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
     
    Chris F.A. Johnson, Nov 1, 2008
    #3
  4. someone_else

    someone_else Guest

    "Chris F.A. Johnson" <> wrote in message
    news:9e509$490c93c9$cef88ba3$...
    > On 2008-11-01, someone_else wrote:
    >> hi all,
    >> I want to build a website where each page contains a common set of links
    >> to
    >> other pages in the site. However, when I add a link, at a later date, I
    >> don't want to have to add it manually to each page.
    >>
    >> I have a rudimentary understanding of CSS, but I can't figure out how to
    >> use
    >> it to create my basic page template, which contains the common links.

    >
    > You don't use CSS; that is for presentation, not content.
    >
    >> I'm sure I must be missing something very obvious.
    >> Any simple examples out there?

    >
    > Use server-side includes (SSI):
    >
    > <!--#include file="links.html" -->
    >
    > You may have to name the enclosing file with a .shtml suffix or set
    > the execute bit on it, depending on how your web server is set up.
    >
    > --
    > Chris F.A. Johnson, webmaster <http://Woodbine-Gerrard.com>
    > ===================================================================
    > Author:
    > Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)



    Thanks for the quick replies guys.
    Since my host does not provide SSI it looks like I will just have to
    manually change each page. I can probably create a script in C or perl to
    edit the files, but that'll take me longer than manually changing the pages!
    Might be a fun project though.
     
    someone_else, Nov 1, 2008
    #4
  5. Adrienne Boswell wrote:

    > You want to look into some sort of server side include, depending on
    > what language your hosting provider has available. For example
    >
    > <?php include = "nav_inc.php"; ?>


    In PHP that's

    <?php include("nav_inc.php"; ?>

    > or
    > <!--#include file = "nav_inc.asp"-->
    >



    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Nov 1, 2008
    #5
  6. someone_else wrote:

    > Since my host does not provide SSI it looks like I will just have to
    > manually change each page.


    Does host support PHP?

    > I can probably create a script in C or perl to
    > edit the files, but that'll take me longer than manually changing the pages!
    > Might be a fun project though.



    Google "html preprocessor"

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Nov 1, 2008
    #6
  7. Gazing into my crystal ball I observed "Jonathan N. Little"
    <> writing in news:2f94c$490cb316$40cba7aa$27166
    @NAXS.COM:

    >> <?php include = "nav_inc.php"; ?>

    >
    > In PHP that's
    >
    >


    I _knew_ that. I just should refrain from posting in the morning before I
    have coffee.

    --
    Adrienne Boswell at Home
    Arbpen Web Site Design Services
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
     
    Adrienne Boswell, Nov 1, 2008
    #7
  8. someone_else

    C A Upsdell Guest

    someone_else wrote:
    >>> I want to build a website where each page contains a common set of links
    >>> to
    >>> other pages in the site. However, when I add a link, at a later date, I
    >>> don't want to have to add it manually to each page.

    > Since my host does not provide SSI it looks like I will just have to
    > manually change each page. I can probably create a script in C or perl to
    > edit the files, but that'll take me longer than manually changing the pages!
    > Might be a fun project though.


    Or use a text editor that can do a global search and replace.
     
    C A Upsdell, Nov 1, 2008
    #8
  9. someone_else

    someone_else Guest

    "C A Upsdell" <> wrote in message
    news:geicjg$g47$...
    > someone_else wrote:
    >>>> I want to build a website where each page contains a common set of
    >>>> links to
    >>>> other pages in the site. However, when I add a link, at a later date, I
    >>>> don't want to have to add it manually to each page.

    >> Since my host does not provide SSI it looks like I will just have to
    >> manually change each page. I can probably create a script in C or perl to
    >> edit the files, but that'll take me longer than manually changing the
    >> pages! Might be a fun project though.

    >
    > Or use a text editor that can do a global search and replace.
    >


    I have and old version of Dreamweaver here, and it looks like it does 'block
    find and replace' on multiple files .. great! .. I'll give it a try.
     
    someone_else, Nov 1, 2008
    #9
  10. someone_else

    dorayme Guest

    In article <490ca087$>,
    "someone_else" <> wrote:

    > Since my host does not provide SSI it looks like I will just have to
    > manually change each page.


    In the past when people say this, others here say, get another host.
    Because some sort of include is about the only really efficient way to
    do this.

    Even for me to get the energy to say this I had to have enough cups of
    coffee to make a slope prance around like a boistrous monkey.

    --
    dorayme
     
    dorayme, Nov 1, 2008
    #10
  11. someone_else wrote:

    >
    > "Chris F.A. Johnson" <> wrote in message
    > news:9e509$490c93c9$cef88ba3$...
    >> On 2008-11-01, someone_else wrote:
    >>> hi all,
    >>> I want to build a website where each page contains a common set of links
    >>> to
    >>> other pages in the site. However, when I add a link, at a later date, I
    >>> don't want to have to add it manually to each page.
    >>>
    >>> I have a rudimentary understanding of CSS, but I can't figure out how to
    >>> use
    >>> it to create my basic page template, which contains the common links.

    >>
    >> You don't use CSS; that is for presentation, not content.
    >>
    >>> I'm sure I must be missing something very obvious.
    >>> Any simple examples out there?

    >>
    >> Use server-side includes (SSI):
    >>
    >> <!--#include file="links.html" -->
    >>
    >> You may have to name the enclosing file with a .shtml suffix or set
    >> the execute bit on it, depending on how your web server is set up.
    >>
    >> --
    >> Chris F.A. Johnson, webmaster <http://Woodbine-Gerrard.com>
    >> ===================================================================
    >> Author:
    >> Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)

    >
    >
    > Thanks for the quick replies guys.
    > Since my host does not provide SSI it looks like I will just have to
    > manually change each page. I can probably create a script in C or perl to


    Free hosting?


    --
    Blinky
    Killing all posts from Google Groups
    The Usenet Improvement Project: http://improve-usenet.org
    Need a new news feed? http://blinkynet.net/comp/newfeed.html
     
    Blinky the Shark, Nov 1, 2008
    #11
  12. someone_else

    David Segall Guest

    "Chris F.A. Johnson" <> wrote:

    >On 2008-11-01, someone_else wrote:
    >> hi all,
    >> I want to build a website where each page contains a common set of links to
    >> other pages in the site. However, when I add a link, at a later date, I
    >> don't want to have to add it manually to each page.
    >>
    >> I have a rudimentary understanding of CSS, but I can't figure out how to use
    >> it to create my basic page template, which contains the common links.

    >
    > You don't use CSS; that is for presentation, not content.
    >
    >> I'm sure I must be missing something very obvious.
    >> Any simple examples out there?

    >
    > Use server-side includes (SSI):
    >
    > <!--#include file="links.html" -->

    How do you make the required changes to distinguish the active menu
    item from the remainder? For example, on my site, the menu items have
    a class of menuItem but the current page has a class of menuItemActive
    in its link. I use CSS to reference the class and highlight the
    current item.
     
    David Segall, Nov 2, 2008
    #12
  13. someone_else

    Sitedude Guest

    On Nov 1, 12:27 pm, "someone_else"
    <> wrote:
    > hi all,
    > I want to build a website where each page contains a common set of links to
    > other pages in the site. However, when I add a link, at a later date, I
    > don't want to have to add it manually to each page.
    >
    > I have a rudimentary understanding of CSS, but I can't figure out how to use
    > it to create my basic page template, which contains the common links.
    >
    > I'm sure I must  be missing something very obvious.
    > Any simple examples out there?
    > cheers


    I see some good input here. Personally I use <!--#include virtual="/
    myfolder/myfile.inc"--> however since your host will not allow you to
    use the SSI and you would have to change the files to .shtml or .shtm
    for that to work. You could get a javascript menu and use that or you
    could use a little trick script like this
    //trick jscript
    <!--hide from old browsers
    document.write ("<a href='http://drcwebs.net/index.html'>Index Page</
    a>");
    -->
    //end trick
    In a text editor create a file with your links using the
    document.write and save it as something like mylinks.js then place
    this code in your html file where you want the links to be <script
    language="JavaScript" SRC="http://mysite.com/myjsfolder/mylinks.js"
    type="text/javascript"></script>
    It's a little down and dirty but I got it to work on my local server
    good luck with it hope it helps
     
    Sitedude, Nov 2, 2008
    #13
  14. someone_else

    dorayme Guest

    In article <>,
    David Segall <> wrote:

    > How do you make the required changes to distinguish the active menu
    > item from the remainder? For example, on my site, the menu items have
    > a class of menuItem but the current page has a class of menuItemActive
    > in its link. I use CSS to reference the class and highlight the
    > current item.


    You can do like this in the include:

    <li<?php if ($thisPage=="index") echo " id=\"currentpage\""; ?>
    class="name"><a href="index.html">Home</a></li>

    And have the pages marked at the top of the doc type with such as:

    <?php $thisPage="index"; ?>

    and, of course, styles for "name"

    There is likely more elegant, but this works to do distinguishing things
    with the current navigational item.

    --
    dorayme
     
    dorayme, Nov 2, 2008
    #14
  15. someone_else

    rf Guest

    "Sitedude" <> wrote in message
    news:...
    On Nov 1, 12:27 pm, "someone_else"
    <> wrote:

    > //trick jscript
    > <!--hide from old browsers


    This idea of HTML comments inside script elements is to correct a bug in
    IIRC Netscape version 2 which is now totally obsolete, and that was only for
    script elements in the document, not for script residing in an external
    file.

    Please don't suggest that anybody use this cargo cult stuff in this century.

    > document.write ("<a href='http://drcwebs.net/index.html'>Index Page</


    Which will not work for somewhere between 10 and 15 percent of visitors.
    Even if we are lenient and say only 8% of visitors don't have javascript
    available or enabled then this is the equivalent of turning your server off
    for about one month during the year. And for something as mission critical
    as a menu to access other pages on the site is unforgivable.

    In addition your most important visitor, googlebot, will be totally unable
    to index the site.

    The correct way to do this is server side, using SSI or some scripting
    language such as PHP, the latter giving the added benefit of having the
    "link" to the current page "disabled". If the current host does not support
    PHP then there is another one just up the road that does.
     
    rf, Nov 2, 2008
    #15
  16. someone_else

    Sitedude Guest

    On Nov 1, 11:57 pm, "rf" <> wrote:
    > "Sitedude" <> wrote in message
    >
    > news:...
    > On Nov 1, 12:27 pm, "someone_else"
    >
    > <> wrote:
    > > //trick jscript
    > > <!--hide from old browsers

    >
    > This idea of HTML comments inside script elements is to correct a bug in
    > IIRC Netscape version 2 which is now totally obsolete, and that was only for
    > script elements in the document, not for script residing in an external
    > file.
    >
    > Please don't suggest that anybody use this cargo cult stuff in this century.
    >
    > > document.write ("<a href='http://drcwebs.net/index.html'>Index Page</

    >
    > Which will not work for somewhere between 10 and 15 percent of visitors.
    > Even if we are lenient and say only 8% of visitors don't have javascript
    > available or enabled then this is the equivalent of turning your server off
    > for about one month during the year. And for something as mission critical
    > as a menu to access other pages on the site is unforgivable.
    >
    > In addition your most important visitor, googlebot, will be totally unable
    > to index the site.
    >
    > The correct way to do this is server side, using SSI or some scripting
    > language such as PHP, the latter giving the added benefit of having the
    > "link" to the current page "disabled". If the current host does not support
    > PHP then there is another one just up the road that does.


    I suppose you are correct about the html comment. Old habits are hard
    to break sometimes and I forgot to mention the <no script> tag should
    be used or the W3C validator will complain. If the host will not
    enable SSI then they are probably too cheap to support php. The best
    advice is to find another host and do this task properly .
     
    Sitedude, Nov 2, 2008
    #16
  17. someone_else

    richard Guest

    On Sat, 1 Nov 2008 21:30:33 -0700 (PDT), Sitedude
    <> wrote:

    >On Nov 1, 12:27 pm, "someone_else"
    ><> wrote:
    >> hi all,
    >> I want to build a website where each page contains a common set of links to
    >> other pages in the site. However, when I add a link, at a later date, I
    >> don't want to have to add it manually to each page.
    >>
    >> I have a rudimentary understanding of CSS, but I can't figure out how to use
    >> it to create my basic page template, which contains the common links.
    >>
    >> I'm sure I must  be missing something very obvious.
    >> Any simple examples out there?
    >> cheers

    >
    >I see some good input here. Personally I use <!--#include virtual="/
    >myfolder/myfile.inc"--> however since your host will not allow you to
    >use the SSI and you would have to change the files to .shtml or .shtm
    >for that to work. You could get a javascript menu and use that or you
    >could use a little trick script like this
    >//trick jscript
    ><!--hide from old browsers
    >document.write ("<a href='http://drcwebs.net/index.html'>Index Page</
    >a>");
    >-->
    >//end trick
    >In a text editor create a file with your links using the
    >document.write and save it as something like mylinks.js then place
    >this code in your html file where you want the links to be <script
    >language="JavaScript" SRC="http://mysite.com/myjsfolder/mylinks.js"
    >type="text/javascript"></script>
    >It's a little down and dirty but I got it to work on my local server
    >good luck with it hope it helps



    And just how will javascript make the changes across the entire site?
    Your code would have to be placed on every page.
    Then what if I have JS turned off?

    Your idea would be much better served in PHP.
     
    richard, Nov 2, 2008
    #17
  18. someone_else

    rf Guest

    "Sitedude" <> wrote in message
    news:...
    On Nov 1, 11:57 pm, "rf" <> wrote:

    > I suppose you are correct about the html comment. Old habits are hard
    > to break sometimes


    Even after more than a decade? :)

    > and I forgot to mention the <no script> tag should


    <noscript> (no space) *element*.

    > be used or the W3C validator will complain.


    No it won't.

    And, sadly, the most common use of the noscript element is to proclaim
    something like:
    <noscript>Javascript is required for you to navigate this site</noscript>

    > If the host will not
    > enable SSI then they are probably too cheap to support php. The best
    > advice is to find another host and do this task properly .


    Indeed.
     
    rf, Nov 2, 2008
    #18
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    4
    Views:
    463
    Travis Newbury
    Mar 21, 2006
  2. Web Developer

    char 8bit wide or 7bit wide in c++?

    Web Developer, Jul 31, 2003, in forum: C++
    Replies:
    2
    Views:
    595
    John Harrison
    Jul 31, 2003
  3. Disc Magnet
    Replies:
    2
    Views:
    726
    Jukka K. Korpela
    May 15, 2010
  4. Disc Magnet
    Replies:
    2
    Views:
    800
    Neredbojias
    May 14, 2010
  5. Martin Rinehart

    80 columns wide? 132 columns wide?

    Martin Rinehart, Oct 31, 2008, in forum: Javascript
    Replies:
    16
    Views:
    184
    John W Kennedy
    Nov 13, 2008
Loading...

Share This Page