Log in

View Full Version : Is it possible to build HTML modules to be called to save repetitive code?



copealan
01-04-2008, 11:30 PM
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?

ddadmin
01-05-2008, 01:20 AM
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() (http://ca3.php.net/manual/en/function.include.php)function for that purpose, and so on.

arshad
01-09-2008, 08:36 AM
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.

mohaakilla51
01-09-2008, 06:00 PM
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

ReMaX
01-14-2008, 03:52 PM
simply use MODx CMF (http://www.modxcms.com)!!! Best cms of the world ;)!!!