Suggestion: move html headers to header.php & split header

airblaster <[email protected]> 7 Sep 2003 16:09:39 -0000
Newsgroups gmane.comp.web.oscommerce.suggestions
Message-ID <d0e14a940bc6e15e4361b06b82c9f928@osCommerce-Forums>
This message was sent from: Suggestions and Proposals
http://forums.oscommerce.com/viewtopic.php?p=225649#225649
----------------------------------------------------------------

In OSC's current state its impossible to include OSC into a site without using frames or modifying dozens of files.
To change this I suggest to replace the current header code (the part which includes header.php) with something like this:

[code]<!-- header_top //-->
<?php require(DIR_WS_INCLUDES . 'header_top.php'); ?>
<!-- header_top_eof //-->

<script language="javascript" src="includes/general.js"></script>
(lots of JavaScript Code can go here)

<!-- header_bottom //-->
<?php require(DIR_WS_INCLUDES . 'header_bottom.php'); ?>
<!-- header_bottom_eof //-->

<!-- body //-->
........[/code]

header_top.php would contain everything till <head> (or the stylesheet definition if it is supposed to be included on every page), and header_bottom.php everything beginning from </head>.
The html footer code would also be moved to footer.php.
Dynamic titles could still be used if you simply output a variable containing the title of the current page.

[b][u]This method has got several advantages:[/b][/u]
 - removes redundancy of HTML header code (change html header/footer at only 1 place instead of dozens of files)
 - its possible to include induividual javascript functions and other code that goes between the <head> and </head> only for the files that need the code.
 - [b]allows users to integrate osCommerce into the Design of their webpage easily (e.g. they can include their php based framework that always displays its own html headers)[/b]
 - its easy to implement