Tutorials
Reviews section (with MTAmazon)
-
Reviews section (with MTAmazon)
Posted on August 17, 2004
Written by
Sasha (view more by Sasha)
Comments (0)
Filed under Movable Type, Tutorials
I have been asked loads of times how I created my own Book Reviews section on my personal site, so here’s a tutorial explaining how.
For this tutorial you’ll need Movable Type 2.x. It might work in MT3 as well, but I haven’t tested it so I’m not sure. You’ll also need to have MTAmazon installed and working properly. This tutorial will not tell you how to install MTAmazon, however.
Please note that you can use this tutorial for more than just book reviews. Using Amazon, you could also review CDs, DVDs, games, etc. The categories in this tutorial are used as the Book Categories (Fiction, Non-Fiction, Childrens, etc), but obviously they can be used for other things as well. For example, if you’re reviewing games, you might want to create a category for each game platform (PC, PS2, XBox) that you’re reviewing.
This tutorial is just to give you an idea of how to set something like this up properly.
And as always, this tutorial assumes you’re using PHP headers and footers for your site. If you’re not, just replace the PHP includes with whatever HTML coding you’d like there.
Create a new blog in MT. My Core Setup settings look like this, where "books" is the folder I’ll be putting the reviews in (so replace books with something else if you don’t want it all in a "books" folder):
Weblog Name: Books
Local Site Path: /your/absolute/path/to/books
Site URL: http://domain.com/books/
Local Archive Path: same as Local Site Path
Archive URL: same as Site URL
Under Preferences, make sure that you have selected Individual as Preferred Archive Type, and php as the file extension for archive files.
Under Archiving, make sure you have the boxes ticked next to Individual and Category. Fill in the following under Archive File Template:
-
Individual:
<MTEntryDate format="%Y">/<MTEntryDate format="%m">/<MTEntryTitle dirify="1">.php
-
Category:
<MTCategoryLabel dirify="1">.php
Now go into the Templates section. The only templates you’ll really need for this tutorial are Main Index, Category Archive, and Individual Entry Archive, so feel free to delete the rest if you’re not using them.
Click on Main Index, and copy and paste the following coding into it:
<?php include("/path/to/your/header.php"); ?>
<h2>Recent Reads</h2>
<MTEntries lastn="3">
<MTAmazon method="Asin" search="[MTEntryMore]">
<a href="<MTAmazonLink>"><img src="<MTAmazonMediumImage>" border="0" class="floatleft" alt="<MTAmazonTitle>" /></a>
<h3><$MTEntryDate format="%x"$> ::<a name="<$MTEntryID pad="1"$>"></a> <strong><$MTEntryTitle$></strong></h3>
<p><MTAmazonTitle><br />
By <MTAmazonAuthor><br />
Released <MTAmazonReleaseDate format="%B %e, %Y"><br />
<MTAmazonSalePrice></p></MTAmazon>
<p><$MTEntryExcerpt$>
<a href="<MTEntryLink>"><b>[more...]</b></a><br />
</p>
</MTEntries>
<h2>Genres</h2>
<ul><MTCategories>
<li><a href="<$MTCategoryArchiveLink$>"><$MTCategoryLabel$></a> [ <MTCategoryCount> ]</li>
</MTCategories></ul>
<h2>Older Reads</h2>
<ul>
<MTArchiveList archive_type="Monthly">
<li>In <b><$MTArchiveTitle$></b> I read the following book(s):<br/>
<MTEntries>- <a href="<$MTEntryLink archive_type="Individual"$>"><$MTEntryTitle$></a> </MTEntries> - <br /> <br /></li>
</MTArchiveList></ul>
<?php include("/path/to/your/footer.php"); ?>
Hit save, and go to the Category Template. Copy the following code into the Category template:
<?php include("/path/to/your/header.php"); ?>
<h1>Book List</h1>
<h2><$MTArchiveCategory$></h2>
<ul><MTEntries>
<li><a href="<MTEntryLink>"><MTEntryTitle></a> (<MTEntryDate format="%x">)</li>
</MTEntries>
</ul>
<?php include("/path/to/your/footer.php"); ?>
Hit save again, and now go to the Individual Entry Archive. Copy the following code into there:
<?php include("/path/to/your/header.php"); ?>
<h2><$MTEntryDate format="%x"$> - <$MTEntryTitle$></h2>
<div align="center">
<MTEntryPrevious>
<a href="<$MTEntryLink$>">« <$MTEntryTitle$></a> |
</MTEntryPrevious>
<a href="/">Main</a>
<MTEntryNext>
| <a href="<$MTEntryLink$>"><$MTEntryTitle$> »</a>
</MTEntryNext>
</div>
<$MTEntryTrackbackData$>
<div class="blog">
<MTAmazon method="Asin" search="[MTEntryMore]">
<a href="<MTAmazonLink>"><img src="<MTAmazonMediumImage>" border="0" alt="<MTAmazonTitle>" /></a>
<ul>
<li>Title: <b><MTAmazonTitle></b></li>
<li>Author: <b><MTAmazonAuthor></b></li>
<li>Genre: <b><MTEntryCategories glue=", "><a href="<$MTCategoryArchiveLink$>"><$MTCategoryLabel$></a></MTEntryCategories></b></li>
<li>Published By: <b><MTAmazonManufacturer></b></li>
<li>Published On: <b><MTAmazonReleaseDate format="%B %e, %Y"></b></li>
<li>Type: <b><MTAmazonField name="Media"></b></li>
<li>Price: <b><MTAmazonSalePrice></b></li>
<li>Avg. Customer Rating: <b><MTAmazonField name="Reviews/AvgCustomerRating"></b> stars</li>
<li>[ <a href="<MTAmazonLink>">Buy Now</a> ]</li>
</ul>
</MTAmazon>
<$MTEntryBody convert_breaks="1"$>
<div class="by"><b>Agree? Disagree?</b> <MTEntryIfAllowComments><a href="<$MTCGIPath$><$MTCommentScript$>?entry_id=<$MTEntryID$>" onclick="OpenComments(this.href); return false">Speak up!</a> (<$MTEntryCommentCount$>)</MTEntryIfAllowComments></div>
</div>
<? include("/path/to/your/footer.php"); ?>
Obviously, if you’re not reviewing books, you’ll want to edit the fields mentioned above. A CD won’t have an Author, so you’d need to take that out. Here is a list of tags that you can use in MTAmazon.
When you’re done, hit Save again.
Now you’re ready to publish your first review. Click on New Entry in the navigation bar, and put the following into the entry fields:
Entry Title: Book Title
Category: Book’s category
Entry Body: Your review of the book
Extended Entry: The book’s ISBN or ASIN number (look it up on Amazon)
And that’s all. Now when you hit Save Entry (and make sure that Post Status is set to Publish), your first book review will show up!
If you get any errors, keep in mind that they’re usually caused by MTAmazon. Double check that you have the right ASIN number, and that there are no spaces around the number in the Extended Entry field. If you’re reviewing something else than books, make sure that the tags you used in the templates are actually available for whatever it is that you’re reviewing.
And lastly, keep in mind that this is just the way I do it. There are many other ways to achieve a similar result, please don’t feel like you have to copy me exactly. This tutorial is more meant to give you an idea of how to use MT’s versatality than a step-by-step-this-is-the-only-way-to-do-it guide.
Have fun with it!
PLEASE NOTE: If you’re getting MTAmazon errors with this tutorial, please take a look at the following forum thread!
Comments
Comments are closed for this entry.