SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Nov 2011
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Call funtions that reside in a different file

    I would like to know if it is possible to create a template in any language, HTML, CSS, jQuery, JavaScript, etc.

    where I could create a template for my site with a header (with an image), sidebar (for instance a selector, images, and somethingelse), footer(with links to other pages like about page, contact us, etc), and I central area where I introduce a different code an info to each HTML page.

    My idea is so I can modify only in one place the image of the header, the selector or the sidebar or any other element so it will change in all the HTML pages instead of having to have to change it in every single HTML page.

    IF it is possible, how could I do it with the following selector?

    Code:

    <select id="mySelect" onchange="if(this.options[this.selectedIndex].value != ''){window.top.location.href=this.options[this.selectedIndex].value}">
    <option>Select an option</option>
    <option value="http://www.google.com">Orange</option>
    <option value="http://www.google.com">Pineapple</option>
    <option value="http://www.google.com">Banana</option>
    </select>Thanks so much

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,712
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by samuvk View Post
    I would like to know if it is possible to create a template in any language, HTML, CSS, jQuery, JavaScript, etc.

    where I could create a template for my site with a header (with an image), sidebar (for instance a selector, images, and somethingelse), footer(with links to other pages like about page, contact us, etc), and I central area where I introduce a different code an info to each HTML page.
    CSS is used to provide a consistent presentation across multiple pages, and a server-side language such as PHP is used to provide consistent content.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,203
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by samuvk View Post
    My idea is so I can modify only in one place the image of the header, the selector or the sidebar or any other element so it will change in all the HTML pages instead of having to have to change it in every single HTML page.
    That's standard with things like a CMS, but also easy to do with very simple PHP. It's better to do this sort of thing with a server-side lingo like PHP. JS can easily be turned off in a browser, meaning that if someone with JS off visits your site, the layout would be totally borked.


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
  •