This script is so configurable it can get very confusing; just remember that these are all options. You can just insert your affiliate code, plop this script on your server, and it will run. If you decide to configure it; take it slowly, change one thing at a time, and study the examples. If all else fails check out the Support Forum.
Template files. Simple text files containing the HTML and variables you want my script to use to match your site's look and feel. These are used in sets with different sets each in their own subfolder of the templates folder. With each template file having a specific name. You can use as many sets as you would like so that 1 script can display different items in different ways. Please study the default template files for the proper use of the variables.
page.template contains the HTML to display the final page. At a minimum this file must contain %%products_html%% as it contains all of the products using the HTML from the products.template
The available variables for use in page.template are listed here.
products.template contains the HTML you want applied to each product.
The available variables for use in products.template are listed here.
item.template contains the HTML to display an individual item. This is the big one; there are lots of things you can display about an item.
The available variables for use in item.template are listed here.
larger_image.templates contains the HTML to display an the large image from Amazon.
The available variables for use in larger_image.template are listed here.
You specify which set of templates to use in the URL with templates followed by the name of the subfolder, like templates=Default. You can even specify one set of templates to display the page and with link_templates another set to be used with any link that is clicked on that page.
To demonstrate look at this page No Options Here; then look at my gaming page half way down the right column Options Used Here and you'll see the bestselling games from Amazon. These are produced with the same script. On the gaming page I just called the script with SSI like this: <!--#include virtual="/cgi-bin/apf4/amazon_products_feed.cgi?Operation=ItemSearch&SearchIndex=VideoGames&BrowseNode=471280&templates=ssi&link_templates=default" -->
The options and the HTML they effect are enclosed in a special comment tag. <!--apf &option1=value&option2=value! HTML here !-->
Notice the exclamation points, they separate the different parts of the command. <!--apf tells the script that options will follow. All options must be proceeded by an & to separate them and the last option is indicated by following it with an !. Anything following that ! through !--> is considered the HTML you want to control. If the option doesn't contain HTML, like for including a text file, the exclamation points still need to be there.
apf_include - include a text file or nav_menu. As seen in this example.
For a Text File this is like a Server Side Include (SSI). If you have HTML that you use on many pages (like the menu links at the bottom of all of my pages) you can use this option to include that file in the template.
For a nav_menu it is used with %%nav_menu%% to display a dynamic navigational menu.
The three following options were primarily created to build TABLE rows.
apf_start - product to start using the HTML at
This is optional if it is not specified the HTML starts with the first product.
apf_end - last product to use HTML at
You can use the word last to specify the last product. And this option will always add the HTML to the end product, which is necessary to close off any open <TR>s.
apf_repeat - how often to repeat the HTML
If 1 use with every product, 2 every other product, 3 every third, etc.
These options are demonstrated with this Web Services search. Note that there are now TABLE rows!
Languages work like the templates. Simple text files of all the variables that contain the text the script displays that does not come from Amazon. If you wish to create your own language file please use the default English files as a starting point and be sure and send me a copy so we can share it with others. I would like to provide as many different languages as possible.
You specify which language to use in the URL with language.
To display multiple languages in HTML there is a special charset (character set) called Unicode. This is the format that Amazon sends their results in and so it is what my script uses. To use accented characters in the language files you must use Unicode entities. Entities are just &#(a number);. I wrote a script to display the characters and show the entity for each so you can use them in your language file - Unicode Generator.
Amazon usually only returns 10 products per page. But you can add variables to your page.template that will display links to more results.
%%see_next%% will display a link to the next page of products %%see_prev%% will display a link to the previous page %%see_total%% will display the total number of pages %%see_index%% will display a "Google" type index of pages
Amazon.com, Amazon.co.uk, and Amazon.de are currently supported. The code is in place to support Japan but because of the language barrier it hasn't been tested. You can select which location to use in the URL by using &locale=us, &locale=uk, or &locale=de. I plan to support CA when a feed is available and maybe other sites if the language barrier can be overcome.