Please help for building my site with menus and external css

Discussion in 'HTML' started by coolunmesh@gmail.com, Apr 26, 2006.

  1. Guest

    I've designed my site long ago. but the problem is that i've a few
    menus in every page. so i need to add the same code for the same menu
    in every page except its own link( like no "about me' link in "about me
    "page). at the same time i need to put the same css code in evey page.
    and the menu is not located at the same place in every page. The menus
    in every page is different compared to other websites.

    Please help to fix the problem.
     
    , Apr 26, 2006
    #1
    1. Advertising

  2. __/ [ ] on Wednesday 26 April 2006 17:42 \__

    > I've designed my site long ago. but the problem is that i've a few
    > menus in every page. so i need to add the same code for the same menu
    > in every page except its own link( like no "about me' link in "about me
    > "page). at the same time i need to put the same css code in evey page.
    > and the menu is not located at the same place in every page. The menus
    > in every page is different compared to other websites.
    >
    > Please help to fix the problem.


    Hi,

    CSS should be peripheral. Several pages can share the same stylesheet and
    should do so if they bear a commonality (duplication is always a bad idea),
    e.g. include <link rel="stylesheet" href="/styles/yourstyle.css"
    type="text/css" /> between <head> and </head>. If you want to add this line
    of code to many files in one fell swoop, you could use GNU/Linux tools, e.g.

    find . -maxdepth 1 -type f -name '*.html' -print |
    while read filename
    do # print all filenames
    (
    sed 's/<head>/<head><link rel="stylesheet"
    href="/styles/yourstyle.css" type="text/css" />/i;'
    $filename >$filename.xxxxx
    mv $filename.xxxxx $filename
    # replace output files with original
    )
    done

    The same strategy goes for menus. Menus are better written in a single place,
    which makes them easier to change without pattern recognition and mass-file
    replacement. If you don't use a CMS, you may wish to add a menu with a
    complete set of links and disable individual to-self links manually, page by
    page.

    Hope it helps,

    Roy

    --
    Roy S. Schestowitz | "Black holes are where God is divided by zero"
    http://Schestowitz.com | SuSE Linux ¦ PGP-Key: 0x74572E8E
    6:05pm up 4 days 3:16, 9 users, load average: 0.42, 0.44, 0.54
    http://iuron.com - Open Source knowledge engine project
     
    Roy Schestowitz, Apr 26, 2006
    #2
    1. Advertising

  3. Guest

    Please tell me how a single menu can be shared in all pages ?
     
    , Apr 26, 2006
    #3
  4. Paul Watt Guest

    <> wrote in message
    news:...
    > Please tell me how a single menu can be shared in all pages ?
    >


    php includes or ssi
     
    Paul Watt, Apr 26, 2006
    #4
  5. Jim Moe Guest

    wrote:
    > I've designed my site long ago. but the problem is that i've a few
    > menus in every page. so i need to add the same code for the same menu
    > in every page except its own link( like no "about me' link in "about me
    > "page). at the same time i need to put the same css code in evey page.
    > and the menu is not located at the same place in every page. The menus
    > in every page is different compared to other websites.
    >

    Put the CSS into a separate file. Add one of these to the <head>:
    <link rel="stylesheet" href="/styles/common.css" type="text/css">
    or
    <style type="text/css">
    @import url("/styles/common.css");
    </style>

    See <http://allmyfaqs.net/faq.pl?Include_one_file_in_another>.

    --
    jmm (hyphen) list (at) sohnen-moe (dot) com
    (Remove .AXSPAMGN for email)
     
    Jim Moe, Apr 26, 2006
    #5
  6. Neredbojias Guest

    To further the education of mankind, vouchsafed:

    > I've designed my site long ago. but the problem is that i've a few
    > menus in every page. so i need to add the same code for the same menu
    > in every page except its own link( like no "about me' link in "about me
    > "page). at the same time i need to put the same css code in evey page.
    > and the menu is not located at the same place in every page. The menus
    > in every page is different compared to other websites.


    PHP is made for your situation. The menu(s) template can be made and
    adjusted to render each virtual page uniquely based on a variable in the
    search string. Google for info about php and includes.

    --
    Neredbojias
    Infinity has its limits.
     
    Neredbojias, Apr 26, 2006
    #6
  7. Toby Inkster Guest

    Roy Schestowitz wrote:

    > sed 's/<head>/<head><link rel="stylesheet"
    > href="/styles/yourstyle.css" type="text/css" />/i;'


    This will work?! Shoudn't you be escaping some of those slashes?

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
    Now Playing ~ ./shawn_mullins/souls_core/06_and_on_a_rainy_night.ogg
     
    Toby Inkster, Apr 29, 2006
    #7
  8. __/ [ Toby Inkster ] on Saturday 29 April 2006 17:22 \__

    > Roy Schestowitz wrote:
    >
    >> sed 's/<head>/<head><link rel="stylesheet"
    >> href="/styles/yourstyle.css" type="text/css" />/i;'

    >
    > This will work?! Shoudn't you be escaping some of those slashes?


    Oops. You're right. I added some slashes without testing, let alone thinking.
    That 'script', by the way, is a derivative of something that /you/ once
    wrote in an answer to my question. I have used this for the processing of
    thousands of pages over the past year or so, mainly after LaTeX->HTML
    conversions. Thanks for that.

    Best wishes,

    Roy

    --
    Roy S. Schestowitz | Useless fact: There are five regular polyhedra
    http://Schestowitz.com | SuSE Linux ¦ PGP-Key: 0x74572E8E
    7:35am up 2 days 14:40, 12 users, load average: 0.70, 1.04, 0.82
    http://iuron.com - Open Source knowledge engine project
     
    Roy Schestowitz, Apr 30, 2006
    #8
  9. Toby Inkster Guest

    Roy Schestowitz wrote:

    > That 'script', by the way, is a derivative of something that /you/ once
    > wrote in an answer to my question.


    Really? I can't imagine I would have written something as fancy as that as
    a shell script. For anything that involves loops and logic, I tend to
    immediately switch to Perl.

    You might want to look at replacing this:

    sed 'script' file >file.xxxxx
    mv file.xxxxx file

    with this:

    sed -i 'script' file

    From "man sed":


    -i[SUFFIX], --in-place[=SUFFIX]

    edit files in place (makes backup if extension supplied)


    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
     
    Toby Inkster, Apr 30, 2006
    #9
  10. __/ [ Toby Inkster ] on Sunday 30 April 2006 12:14 \__

    > Roy Schestowitz wrote:
    >
    >> That 'script', by the way, is a derivative of something that /you/ once
    >> wrote in an answer to my question.

    >
    > Really? I can't imagine I would have written something as fancy as that as
    > a shell script. For anything that involves loops and logic, I tend to
    > immediately switch to Perl.



    With respect, there was nothing overly sophisticated in your previous
    suggestion. I just never knew anything about sed. Then you provided me with
    a useful, extensible template/example. I needed such a tool for editing
    files /en masse/.

    http://schestowitz.com/Software/Search_and_Replace/ (it's not "software", but
    it didn't fit anywhere else)


    > You might want to look at replacing this:
    >
    > sed 'script' file >file.xxxxx
    > mv file.xxxxx file
    >
    > with this:
    >
    > sed -i 'script' file
    >
    > From "man sed":
    >
    >
    > -i[SUFFIX], --in-place[=SUFFIX]
    >
    > edit files in place (makes backup if extension supplied)



    Thanks. To be honest, my filthy beast *grin* is doing its work reliably
    enough and completes the task within a few seconds. I fear change that
    involves subsequent testing, but will keep your kind advice close to hand.

    Best wishes,

    Roy

    --
    Roy S. Schestowitz | "Have you compiled your kernel today?"
    http://Schestowitz.com | SuSE Linux ¦ PGP-Key: 0x74572E8E
    7:00pm up 3 days 1:57, 13 users, load average: 0.49, 0.58, 0.44
    http://iuron.com - help build a non-profit search engine
     
    Roy Schestowitz, Apr 30, 2006
    #10
    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. Guest
    Replies:
    2
    Views:
    546
    Guest
    Feb 2, 2004
  2. news.west.cox.net

    Select menus above flyout menus? help?

    news.west.cox.net, Dec 8, 2004, in forum: HTML
    Replies:
    8
    Views:
    799
  3. MagicFreebiesUK.co.uk

    Help needed regarding css and menus

    MagicFreebiesUK.co.uk, Apr 10, 2005, in forum: HTML
    Replies:
    7
    Views:
    382
    William Hamby
    Apr 12, 2005
  4. KK
    Replies:
    2
    Views:
    596
    Big Brian
    Oct 14, 2003
  5. Midex
    Replies:
    24
    Views:
    921
Loading...

Share This Page