SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2005
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How To Minimise Effort On Constantly Repeated Sections Of Code

    Hi Everyone

    Quick question. When you're working on a web site from home, how do you reduce time spend updating sections of code that are found on very page, for example a nav menu.

    At the moment I have a navigation menu hardcoded onto each and every page. If I want to change the nav menu I need to open up and change each page. Is there a quicker and easier way for the home user. At work we use Server Side Includes, but I don't know how to set those up

    Thanks very much for any help

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    Server Side includes are used by dynamic programming languages such as PHP and ASP.

    You would need to configure either a localhost server on your machine (XAMPP or Apache2triad programs - dead easy to set up) or put your sites on a hosting account.

    When you include an SSI in your files - make sure the file doing the including is a dynamic file, PHP/ASP etc!

    When you say "quicker way for home users" do you mean for the home user to actually do the updates themselves or for you??
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    SitePoint Zealot
    Join Date
    Jun 2005
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, what I meant was, when I'm sat at home using fire ftp and codetch (a coding program), is there anyway that I can make one change to a navigation list, and all the pages on my site will pick that up aside from SSI's?

    Thanks for the reply

    The hosting is achieved via a hosting company called ideal-hosting.

    Thanks

    Didcot 84

  4. #4
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    in that case - no

    Unless you had them in a navigation function in PHP or a very good global find and replace!
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  5. #5
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,287
    Mentioned
    51 Post(s)
    Tagged
    2 Thread(s)
    You'd need to change your pages from static to a template generator. It can be in Perl, PHP, whatever, but basically you'd only have one copy of your menu as HTML and the programme adds it in place every time someone asks for the webpage, You'd also have one copy of your header, one copy of your footer, etc. When looking at the webpage, all you'd see in source is the HTML. But when looking on your machine locally, you'd see the html surrounded by code.

    My company does this, but I can't program so I only write the static pages as examples and then it gets copied and plugged into my colleague's template.

    You can buy them, or make your own, but I can't imagine that even a ready-made one would be easy if you didn't already speak the programming language.

  6. #6
    SitePoint Zealot
    Join Date
    Jun 2005
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks very much stomme poes and spizeZ

    I'll have a look into those template generators, but I'll probably end up carrying on like I always have done.
    Thanks again for your help

  7. #7
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I use PHP includes and a FTP program called FileZilla. The combination alone lets me use FileZilla to edit the include files (such as the menu) "live" on the server (it really just downloads a local copy of the file, lets me edit it and then uploads it back to the server when I'm done).

  8. #8
    SitePoint Zealot
    Join Date
    Jun 2005
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Dan

    How do you set up the PHP includes?

  9. #9
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not at home right now so I don't have access to my stuff, but you can look on Google.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •