Connecting Tech Pros Worldwide Forums | Help | Site Map

Automating a Web Site Template

Newbie
 
Join Date: May 2009
Posts: 12
#1: 4 Weeks Ago
I'm working on a web site I'm almost done with designing the appearance using pure HTML and CSS, so I'm done as an HTML template.

Most of the HTML code should be replicated into almost all my current pages and any newly created HTML page.

To copy and paste the HTML for the entire HTML pages, in order to have the same menus, footer, etc., is a tedious and less efficient.

What is the best way to replicate all the COMMON HTML code among all pages, using an automated or a programming way? (in order to be able to modify only one file instead of every file) Also this behavior would be impossible if some design has to change in the future.

Is this doable using only Scripting languages, can I use Java, for instance?

Please help. Thank you
best answer - posted by Markus
Quote:

Originally Posted by hsheboul View Post

I'm working on a web site I'm almost done with designing the appearance using pure HTML and CSS, so I'm done as an HTML template.

Most of the HTML code should be replicated into almost all my current pages and any newly created HTML page.

To copy and paste the HTML for the entire HTML pages, in order to have the same menus, footer, etc., is a tedious and less efficient.

What is the best way to replicate all the COMMON HTML code among all pages, using an automated or a programming way? (in order to be able to modify only one file instead of every file) Also this behavior would be impossible if some design has to change in the future.

Is this doable using only Scripting languages, can I use Java, for instance?

Please help. Thank you

What server architecture are you running your site on? Apache? IIS? Do you have any server-side programming languages available on the site, e.g. PHP, ASP.NET, etc.?

If you do not want to look into these options, then you might see if your hosting provider allows for server side includes (SSI).

Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,949
#2: 4 Weeks Ago

re: Automating a Web Site Template


Quote:

Originally Posted by hsheboul View Post

I'm working on a web site I'm almost done with designing the appearance using pure HTML and CSS, so I'm done as an HTML template.

Most of the HTML code should be replicated into almost all my current pages and any newly created HTML page.

To copy and paste the HTML for the entire HTML pages, in order to have the same menus, footer, etc., is a tedious and less efficient.

What is the best way to replicate all the COMMON HTML code among all pages, using an automated or a programming way? (in order to be able to modify only one file instead of every file) Also this behavior would be impossible if some design has to change in the future.

Is this doable using only Scripting languages, can I use Java, for instance?

Please help. Thank you

What server architecture are you running your site on? Apache? IIS? Do you have any server-side programming languages available on the site, e.g. PHP, ASP.NET, etc.?

If you do not want to look into these options, then you might see if your hosting provider allows for server side includes (SSI).
Newbie
 
Join Date: May 2009
Posts: 12
#3: 3 Weeks Ago

re: Automating a Web Site Template


Quote:

Originally Posted by Markus View Post

If you do not want to look into these options, then you might see if your hosting provider allows for server side includes (SSI).

Thanks Markus, you've been a great saver.

My Web site is hosted on a Linux system, with Apache. But SSI is exactly what I needed; it was the best fit.

The apache docs for ssi-howto and `mod include' were not enough, that I'm currently trying to automate small changes between some pages, e.g. for the menu that differs from one page into another, where the options are dependent on the *current* active page.

Otherwise, all is well.
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,949
#4: 3 Weeks Ago

re: Automating a Web Site Template


Quote:

Originally Posted by hsheboul View Post

Thanks Markus, you've been a great saver.

My Web site is hosted on a Linux system, with Apache. But SSI is exactly what I needed; it was the best fit.

The apache docs for ssi-howto and `mod include' were not enough, that I'm currently trying to automate small changes between some pages, e.g. for the menu that differs from one page into another, where the options are dependent on the *current* active page.

Otherwise, all is well.

Hey, Hsheboul.

The conditional SSI operators may be helpful to you. See the following example:

Expand|Select|Wrap|Line Numbers
  1. <!--#set var='page' value='$DOCUMENT_NAME' -->
  2. <!--#if expr='"${page}" = "page1.html"' -->
  3.     Display menu relative to page 1.
  4. <!--#elif expr='"${page}" = "page2.html"' -->
  5.     Display menu relative to page 2.
  6. <!-- ... -->
  7. <!--#else -->
  8.     Display a default menu.
  9. <!--#endif -->
  10.  
Do you see how you could display a menu based on the page now?

Let me know if you need some more help,
Mark.
Newbie
 
Join Date: May 2009
Posts: 12
#5: 1 Week Ago

re: Automating a Web Site Template


Thanks Markus for your quick reply. I was reading and experimenting through the SSI conditionals, and that requires some sort of "twedling" with the Apache server docs -- as some new stuff and different things that I was thinking before. For instance, the Linux environment variables need to be set/pass to the Apache.
Reply


Similar HTML / CSS bytes