Results 1 to 5 of 5

Thread: Is it possible to build HTML modules to be called to save repetitive code?

  1. #1
    Join Date
    Aug 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Is it possible to build HTML modules to be called to save repetitive code?

    I occassionaly have an issue with having to do global changes in multiple web pages. I always start from a basic template page but sometimes when adding to the page certain things do get moved or change slightly and a global change does not always work.

    I was wondering if it is possible to build certain code blocks as modules and call when needed similar to using a javascript module?

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    There are many ways to dynamically include the contents of an external file across multiple pages on your site. For example, if your pages are of the .shtml extension, you can use SSI to accomplish the task: http://www.javascriptkit.com/howto/ssi2.shtml If your pages are PHP, there's the include() function for that purpose, and so on.

  3. #3
    Join Date
    Jan 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    use templates in dreamweaver.... it will allow you to make changes in 100 pages on one click on the master page.

    sig removed by admin- You're not allowed to have a sig until you have 5 or more posts.
    Last edited by ddadmin; 01-09-2008 at 01:11 PM.

  4. #4
    Join Date
    Jan 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    You could also (possibly) do that using JavaScript, but that is commonly considered bad practice as some browsers don't allow javascript. However, if the page was not on a server with a server side coding language, your best (and only, as far as I can think of) would be to put your code into a Javascript file, and load it as such. However, as I said, this is commonly not considered practical.

    My recommendation to solve the non javascript enabled browser is to have a backup template that you wouldn't need to change very often put within noscript tags, and put your main template within external javascript files.

    Sorry, but that is the only solution I can think of that doesn't involve Server Side coding, although a simple <?php include("dhjfh.php"); ?> php tag wouldn't be hard, but if you do not have access to php or asp or whatever... then you pretty much are screwed, and have to edit all pages by hand

  5. #5
    Join Date
    Oct 2007
    Location
    Germany, Berlin
    Posts
    41
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    simply use MODx CMF!!! Best cms of the world !!!

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
  •