Introduction
Static Files and folders - the hidden bits
Dynamic Files - what the User Sees
Shop listings:
The shop listing pages are generated by a PHP script. The top of the page is static HTML (with PHP inserting the shop number and shop description text), as is the very bottom of the page. When the shop list table is reached, PHP takes over. This reads the main shop text file, line by line. If the line is not marked for that shop (eg. shop 1, shop 2, etc), it is excluded. Assuming the line is to be written, before processing the line, the headings file is checked, and if a heading is found for that line, it is written to the output. Then the line of the table is formatted, and providing there is a price for the item, a text-input box carrying the product code as its name is included in the line. The two directories containing images and information are checked to see if any file names match the product code. If they exist, the "info" and "camera" icons are added, with appropriate URLs. Those URLs call Javascript to display the relevant popup window.
Information Files:
The "information" popup windows are also built by a PHP script. The product number is passed to the script in the URL called as a parameter. The script reads that parameter (product number), then finds the static version of the "information" file matching the product number. The static version is displayed line by line, until the script finds the comment marker around the cross-reference table. It then reads the cross-reference table carefully, and when a partnumber is found, the PHP checks the directories to see if there are further information or image files (same method as shop listings). If further information or images are found, the icons are added, with URLs. At the end of the table, there is another comment marker, and the script then just displays the remainder of the static file.
Order to Print page:
This is PHP and Javascript, plus some CSS tricks for layout, and is called from a shop listing page.
The "order" area is written with PHP. The shop data text file is opened and read line by line. When a product code from the data file matches one submitted from the form (with quantity other than null), a line of "order" is written. The quantity is used to multiply the issue price, and the running total is increased. When the end of the shop data file is reached, the grand total (before post) is displayed.
The member's name and address is client side javascript, setting and reading cookies on the client machine. If the cookies are found, the values are pasted into the form. If the member decides to not save the values, then a session cookie is used which deletes itself when the browser is closed.
The popup for editing the name and address is controlled by the CSS, for its position and visibility. Also, the CSS has specific entries for print media, so the printed version comes out in a sensible font size on a reasonable amount of paper.
If anyone wants the source code to all of this, please ask.