AMM Function Reference
The $amm object you use in your custom templates contains a number of functions to allow you to display the information about each item you requested.
The $amm object stores 1 or more items, based on what you asked amm_getMedia to fetch for you. All of the following functions relate to the 'Current Item' that the $amm object is looking at.
These functions are 'internal' to the $amm object and don't do anything visible. For that reason they're not much fun, but they are still essential.
This resets $amm so that it is looking at the first item in the results.
This moves the internal counter in $amm up by one, so it looks at the next item in the results. If you are already looking at the last result, this function has no effect.
Returns TRUE if the record has changed.
Returns FALSE if you are at the end of the record set.
This moves the internal counter in $amm down by one, so it looks at the previous item in the results. If you are already looking at the last result, this function has no effect.
Returns TRUE if the record has changed.
Returns FALSE if you are at the start of the record set.
Functions that display information
The following functions all return information about your items, which is far more interesting that what the the other ones do.
Returns the URL to the current item, using the Amazon Affiliate URL format.
If you don't have an affiliate ID, you can leave ours in the options page but if you DO want to use your own, we won't sue you. However, there MUST be an associate ID, so don't delete the default if you don't have a valid one to replace it with!!
Returns the "best guess" Author field.
What do we mean by this... Imagine you want a nice simple template that just shows an Author and the Title of the last book you read. Now consider adding a lawnmower to your AMM (Crazy huh?) A lawnmower doesn't have an Author, it has data stored in the Manufacturer field. Now although you could show Manufacturers AND Authors, this will clutter up your template perhaps unecessarily.
The answer? autoAuthor() tries to guess which field from the current item would best match to the idea of an Author. For example, lots of items have a Manufacturer, some have a Director... etc. By using autoAuthor() in your template you can let AMM best-guess which one to show. The default template is a good example of this, so have a look at it in the amm_extras.php file.
Returns the 'Best Guess' label for the current item.
This is autoAuthor's best friend. It's not much good displaying the manufacturer through autoAuthor if the text label next to it in your template says "Author", that's just mad. autoAuthorLabel() therefore outputs the text label that matches autoAuthor. If autoAuthor printed the items Director, then autoAuthorLabel() will show ' Director'.
Play with it and discover for yourself. It won't hurt :)
Returns the URL of the current item's image
Takes 4 possible parameters:
* 'small' * 'medium' * 'large' * any whole number
Ths function will return the URL for the desired image, based on the country the item you searched for was found in. So it should return Japanese image URLs for Japanese items, etc. If the image URL it generates is unavailable, it will return the image link stored in the AMM database. If even THAT wasn't available, it'll give you amazon's very own 'No Image' pic.
Passing a whole number into the function will return a thumbnail scaled to that size, which is really quite neat.
An example of use would be:
<img src="<?=$amm->autoImage(50);?> /> <img src="<?=$amm->autoImage('medium);?> />
they would return URLs to a 50pixel large image, and a medium image. Support for the "full book cover" images is not available. That's just greedy, and Amazon have to pay their bandwidth bills too!
This behaves exactly like autoImage, except it returns the HTML for a clickable image. Ideal for lazy people!
This returns the current item's date value.
This function accepts a string that is used to format the date. The default value is:
Please refer to http://uk2.php.net/date for more details on how to format a date.
This will return an 'img' tag, linking to one of the following files based on the current items rating:
Feel free to upload your own images to represent ratings 0 to 5.
This returns the current item's stored image value.
It does not return an <img> tag for you, JUST the URL. This is also the 'failsafe' URL, the function autoImage() should be used when outputting images.
This returns the total number of items in the current set of results.
This returns the current item's internal ID.
This returns the current item's Author value.
This returns the current item's Director value.
This returns the current item's Title value.
This returns the current item's ASIN value.
This returns the current item's productGroup value.
This returns the current item's Publisher value.
This returns the current item's Artist value.
This returns the current item's Label value.
This returns the current item's Manufacturer value.
This returns the current item's Model value.
This returns the current item's Brand value.
This returns the current item's userComments value.
This returns the current item's Rating value.
This returns the current item's Country value.