Results 1 to 5 of 5
  1. #1
    Newbie
    Join Date
    January 18th, 2005
    Posts
    11
    Hi there,

    I'm using the latest amazon.pl XML version, and I'm a bit confused about what is and isn't supported.

    In the online docs, for instance, some template things are said to be not supported in the XML version, but in looking at the default template, they DO seem to be supported. Are the docs just outdated?

    Also, is it now possible to have more than template (e.g., one template for books, one compact template, one for music, etc.)?

    Thanks!

  2. #2
    Newbie
    Join Date
    January 18th, 2005
    Posts
    11
    Hmm... okay, from checking your revisions page, it seems that the XML script DOES support multiple templates, but I'm now even more confused than before.

    In particular, I haven't been able to get my head around the distinctions amongst templates, formats, and why some formats end in HTML and others in FMT.

    Any guidance would be most appreciated

  3. #3
    ABW Ambassador cusimano's Avatar
    Join Date
    January 18th, 2005
    Location
    Toronto, Canada
    Posts
    1,369
    The current online documentation is partially out of date. The Revisions History is the most up to date part. In the future, we plan on rewriting the documentation as a .pdf file that can be downloaded/printed.

    The files supplied with the script are a good place to learn from. For example, you can open a template or formatting file in your HTML editor or in Notepad and see how the file works.

    You can have more than one template. The "store" is implemented as several template files (one for each mode= value) in amazon-template/store/*.html To use template file NAME.html add template=NAME to your URL (configuration variable template.dir specifies the directory). If no template= parameter is used, then the script tries template=MODE.html where MODE is the current mode= value (if there is no mode= value or it is a number, then the script guesses what the mode= value is such as "books", "dvd", "vhs", etc.). If the script can't find that template, it tries template=amazon.html (if you renamed the script as shop.pl then shop.html would be tried). If nothing is found, then the "plain vanilla" builtin template is used.

    Template files control the macro "big picture" whereby you can define the layout of the entire page and you say {results} where you want the results to appear in the page.

    Format files control the micro "small picture" whereby you can define the layout of the results that appear in the {results} variable. FYI, the grid= parameter is a wizard that sets some formatting codes. You can think of formatting codes as macros and form letters in a word processor. To see the builtin formatting codes, open amazon-format/library.fmt in Notepad.

    Formatting files can have .html or .htm or .fmt (short for "format") or .txt filename endings -- the ending does not matter to the script. The .html files can be opened in HTML editors, whereas the .fmt files typically cannot because the HTML editor might complain that they are not "valid" HTML (because of the way formatting codes are defined) -- open those in Notepad instead.

    Yours truly,
    Cusimano.Com Corporation
    per: David Cusimano

  4. #4
    Newbie
    Join Date
    January 18th, 2005
    Posts
    11
    Wow, that's a lot to chew on! Thanks very much for the prompt and helpful info.

    And if I may follow up further... is it possible to use template or format files in in-line (php included) segments?

    For instance, if I already have a page at http://smilezone.com/travel/index.htm, can I use php (using the SSI command) to include a list of the three most popular Lonely Planet books, customized to my liking so the comments and prices are listed in the way I want, etc.?

  5. #5
    ABW Ambassador cusimano's Avatar
    Join Date
    January 18th, 2005
    Location
    Toronto, Canada
    Posts
    1,369
    Yes, it is possible to include results in PHP by using the following PHP statement:

    virtual("/cgi-bin/amazon.pl?ssi&PARAMETERS");

    Replace PARAMETERS with the parameters you want, such as:

    /cgi-bin/amazon.pl?ssi&type=browse&mode=17101&grid=c:3,r:1

    Amazon.com browse node 17101 is "Books > Travel > Guidebook Series > Lonely Planet".

    If you have your own custom format file (e.g.: amazon-format/myformat.html), then you could use something like: (the pagesize=3 limits to 3 results as you requested)

    /cgi-bin/amazon.pl?ssi&type=browse&mode=17101&pagesize=3&format=myformat

    Yours truly,
    Cusimano.Com Corporation
    per: David Cusimano

  6. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Amazon XML feed.. all products?
    By Andy@UltraNerds in forum Programming / Datafeeds / Tools
    Replies: 9
    Last Post: August 21st, 2004, 01:39 AM
  2. Amazon XML Q&A
    By stanleyholtsclaw in forum Cusimano.com Scripts
    Replies: 2
    Last Post: October 30th, 2002, 08:49 PM
  3. Problem using Results Templates with Amazon XML
    By maruahues in forum Cusimano.com Scripts
    Replies: 5
    Last Post: October 29th, 2002, 12:50 AM
  4. New Amazon XML script
    By SpongeBob in forum Cusimano.com Scripts
    Replies: 4
    Last Post: October 18th, 2002, 12:19 AM
  5. ETA on Amazon XML?
    By CrazyGuy in forum Cusimano.com Scripts
    Replies: 1
    Last Post: October 3rd, 2002, 04:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •