Automating a Web Site Template | Newbie | | Join Date: May 2009
Posts: 12
| | |
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 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).
|  | Moderator | | Join Date: Jun 2007 Location: York, England, with wolves.
Posts: 4,949
| | | re: Automating a Web Site Template Quote:
Originally Posted by hsheboul 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
| | | re: Automating a Web Site Template Quote:
Originally Posted by Markus 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.
|  | Moderator | | Join Date: Jun 2007 Location: York, England, with wolves.
Posts: 4,949
| | | re: Automating a Web Site Template Quote:
Originally Posted by hsheboul 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: -
<!--#set var='page' value='$DOCUMENT_NAME' -->
-
<!--#if expr='"${page}" = "page1.html"' -->
-
Display menu relative to page 1.
-
<!--#elif expr='"${page}" = "page2.html"' -->
-
Display menu relative to page 2.
-
<!-- ... -->
-
<!--#else -->
-
Display a default menu.
-
<!--#endif -->
-
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
| | | 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.
|  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,501 network members.
|