Sozu Web Studio - Stylish Accessibility

Sozu Web Studio Logo

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.

Internal Functions

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.

resetIndex()

This resets $amm so that it is looking at the first item in the results.

nextItem()

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.

prevItem()

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.

URL()

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!!

autoAuthor()

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.

autoAuthorLabel()

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 :)

autoImage($size)

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!

imageLink (size)

This behaves exactly like autoImage, except it returns the HTML for a clickable image. Ideal for lazy people!

function date($format)

This returns the current item's date value.

This function accepts a string that is used to format the date. The default value is:

    $amm->date('Y-m-d H:i:s');

Please refer to http://uk2.php.net/date for more details on how to format a date.

fancyRatings()

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.

function storedImage()

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.

function totalItems()

This returns the total number of items in the current set of results.

function id()

This returns the current item's internal ID.

function author()

This returns the current item's Author value.

function director()

This returns the current item's Director value.

function title()

This returns the current item's Title value.

function asin()

This returns the current item's ASIN value.

function productGroup()

This returns the current item's productGroup value.

function publisher()

This returns the current item's Publisher value.

function artist()

This returns the current item's Artist value.

function label()

This returns the current item's Label value.

function manufacturer()

This returns the current item's Manufacturer value.

function model()

This returns the current item's Model value.

function brand()

This returns the current item's Brand value.

function userComments()

This returns the current item's userComments value.

function rating()

This returns the current item's Rating value.

function country()

This returns the current item's Country value.

References

All content is ©Sozu Ltd. 2005

Sozu Watermark