|
EDITORIAL REVIEWSIn an eariler chapter we saw how Review Foundry treats customer reviews fields. In this chapter we are going to look at how to add editorial reviews written by the site administrator or an editor. There are lots of ways to integrate editorial reviews into your pages. Because you are able to add arbitrary columns to your tables, and customize your templates as you see fit, you are free to add editorial reviews any way you like. But for those who would like a simple implementation, one is presented here. It involves adding columns to your Item, Member, or Supplier table, depending on what type of editorial reviews you intend to add. For the sake of argument we'll suppose you intend to add editorial reviews for Items. First of all, let me just say something about the case where you add one or more of your own columns to capture the editorial review itself. These would be columns which do not share the special editorial column names discussed later in this page. If you do add such columns, it is a good idea to give each a search weight. That way everything you write will be indexed and searchable with the internal search engine. Also, it is up to you to add Template Toolkit code to the relevant template so that any new editorial text field(s) shows up. For example, if you added a TEXT column named Item.editorial_review, and another called Item.editorial_author, you might have code like the following in your item_page_top.ttml template to display the editorial review when present: [% IF item.editorial_review %] <b>Editor's Review</b> <br/>Provided by [% item.editorial_author %] <br/><br/>[% item.editorial_review %] [% END %] That said, I am now going to assume that you want to approach this process in such a way that you'll do the least amount of work, and allow editorial reviews to be automatically incorporated into the review pages by adding editorial columns of a type that Review Foundry will recognize as earmarked for special treatment. By taking this approach you won't have to ask yourself questions like: "How do I graphically format my accompanying editorial numeric ratings?" All that will be taken care of for you. But before I spell out the column names and column definitions you'll need to use for your "simple" editorial review implemenation, I want to spend a couple of paragraphs detailing the approach which has been adopted. One way to do things would be to set up separate tables for editorial ratings and reviews, and use a foreign key to match up the editorial review records with the corresponding records in the (in our example) Item table. Instead, for the current implementation, we are going to keep it simple and add the ratings directly to the Item table, which is the same place you'll store the editorial review itself, if you provide one. We are also going to make the assumption that if you are going to be adding numerical editorial ratings, they will be for rating attributes that exist in the RatingType table. Furthermore, we are going to assume that your rating attributes are a subset of those offered to visitors when they fill out the rating section of their review form. That way direct comparison between editorial and consumer ratings can easily be made, and your visitors won't be wondering why they are rating on attributes that you, the editor, did not consider important enough to include in your own review. For every editorial rating we intend to add (a number), we'll need to add one column, but we'll treat the case of a single editorial rating attribute differently than for the multiple attribute case. You'll see why shortly (it has to do with how we ultimately display the ratings on the page). The Importance Of Editorial ReviewsIt is great when customer reviews start rolling in and your site begins to fill up with content. But until that time, you need as much traction as you can get with the search engines, so that they bring you traffic. Editorial reviews will help in this regard. They provide the kind of on-target content that your readers are looking for. Because that's the case, the search engines will reward you with potential reviewers. So add editorial reviews if you can afford the time and have the expertise. If not, make sure you add sufficient content to adequately characterize the item you want reviewed (at least fill in the description column or its equivalent). This will help pull in potential reviewers. Single Rating AttributeIf you only need to add a SINGLE number to quantify the item in question, then this is an overall rating, so we won't try to tie it to any particular rating attribute. We'll just add a numeric column named Item.editor_rating_overall and, to give us the flexibility to specify a fractional rating, like 4.2 (out of a maximum of 5, say), we'll make this a FLOAT column. Shown below is the column definition, as seen on the Add Column page used to add a new column to our Item table. Note that you can find out more about adding table columns by reading the section entitled ADDING COLUMNS TO A TABLE
A few things are worthy of note here:
When this column is used to record an editor rating, the rating can be automatically formatted for display, provided you enable the formatting according to the first of the following 2 configuration variables (see the Configure > Build / Browse page): Note that by enabling the second variable, you will also get a similar display for the average customer ratings. But for the moment we are concerned with the editor rating only. It might look something like this when enabled:
Now that you have the rating on the page, let's assume you want to add a textual component to hold your own review. Afterall, a rating without an opinion to back it up won't be regarded very highly by visitors to your pages. The column that you need to add to capture your editorial review, to go with the editor_rating_overall column, should be named editor_review_overall. Its definition is shown below:
Things to note with this column:
When this column is populated with text it will appear on the page under a heading that is controlled by the language variable [% lang.detail.editorial_review %] which, by default, will normally be Editor Review. You can change that by editing the language variable editorial_review in the detail.pl language template. As a matter of convenience, the [% FILTER html_break %] feature of the Template Toolkit is applied to your editorial text, so that you can insert double linebreaks into your review to start new paragraphs, and these will then be replaced by <br/> constructs when the review is placed on the page. There is no need to add line-breaking HTML directly to your review. In fact it is to be avoided, if possible. HTML in TEXT columns can lead to odd effects when viewing records via the admin control panel, as TEXT fields are often truncated for viewing, and a truncated piece of HTML can destroy normal page formatting. Multiple Rating AttributesOK, time to change gears. Now we are considering the case when editor ratings are to be spread across a number of different attributes. In this case we need to add several new columns to store the values. This time no overall rating is directly specified, so the editor_rating_overall column we encountered in the previous section is not needed and is not added to the Item table. Instead, for every rating attribute that we want to record a value for, we will add a column named after the corresponding rating attribute in the RatingType table. In fact, we use the ID value of the RatingType record as part of the column name. As an example, let's say the rating attribute corresponding to the record with RatingType.id = 3 is the Audio Fidelity rating attribute, which might appear in categories dedicated to audio systems. This rating attribute happens to have a maximum possible value (rating scale) of 5. In this case we'll create a new Item.editor_rating_3 column to record the editor's rating of the item's audio fidelity. Note that the RatingType.id value appears as a suffix in the new column name. This column will be an ENUM type with integers as the possible values (1 through 5 = the rating scale), and a drop down menu for selecting the rating. Here is the column definition for our new Item.editor_rating_3 column:
Notes:
This graphical formatting is all done automatically so that adding editor ratings in this manner is very very easy. But you might not be satisfied with the way this looks. If so, study the Template Toolkit code in the item_page.ttml template, and figure out how you might rearrange the information. For example, you'll find code that looks similar to this: [%# LOOP OVER ALL ACTIVE EDITOR RATING TYPES %] [% FOREACH editor_rating = alias.editor_rating_by_attribute %] <tr> <td>[% editor_rating.attribute %]</td> <td>[% editor_rating.image %]</td> <td>([% editor_rating.numeric %])</td> </tr> [% END %] You do not have to stick with the block of rating values formatted into a table. If you want, you can extract individual components and place them on your page wherever you need them to appear. You might do this if you break the editorial review into components and you want each graphical rating to appear above the corresponding section of the review. For example, here's how to display just the Audio Fidelity value, which is the string that appears for the RatingType.attribute column of the corresponding attribute: [%# EXTRACT THE AUDIO FIDELITY ATTRIBUTE ONLY %] [% FOREACH editor_rating = alias.editor_rating_by_attribute %] [% NEXT UNLESS editor_rating.attribute == 'Audio Fidelity' %] <div> [% editor_rating.attribute %] [% editor_rating.image %] ([% editor_rating.numeric %]) </div> [% END %] If you want to add just a SINGLE overall editorial review to go along with your multiple ratings, just add the editor_review_overall column that was discussed in detail in the previous section. Otherwise follow the instructions in the next section. Matching Review ComponentsHere's another possibility, if you decide you want to break up your editorial review into separate components, one component per rating attribute. If your rating attributes have id values (corresponding to the relevant RatingType.id values) of 3, 4, and 5, you will need to add the corresponding new TEXT columns Item.editor_review_3, Item.editor_review_4, and Item.editor_review_5. These will have column definitions just like the Item.editor_review_overall column discussed already. But to spell things out in detail, here is the state of the Add Column page just before you click the button to create a new Item.editor_review_3 column:
Once you have added these extra columns, Template Toolkit code similar to the following is used in the templates to match your editor ratings with your editor review components:
[%# EXTRACT EACH ATTRIBUTE AND PAIR WITH MATCHING REVIEW COMPONENT %]
[% IF global.cfg.browse_bigstar_ratings_editor
AND alias.editor_rating_overall
AND alias.editor_rating_overall <= alias.rating_scale
%]
[% INCLUDE bigstar_ratings_editor %]<br/>
[% END %]
<table class="foundryenclosing">
<tr><td colspan="3">
<b>Editor Review</b><br/><br/></td>
</tr>
[% FOREACH editor_rating = alias.editor_rating_by_attribute %]
[% review_column = 'editor_review_' _ editor_rating.id %]
[% IF item.$review_column AND editor_rating.numeric %]
[%# BOTH AN EDITOR RATING AND REVIEW ARE AVAILABLE %]
<tr><td><b>[% editor_rating.attribute %]</b> <td>
<td>[% editor_rating.image %]</td>
<td> ([% editor_rating.numeric %])</td>
</tr>
<tr><td colspan="3">
[% item.$review_column %]
[% UNLESS loop.last %]<br/><br/>[% END %]</td>
</tr>
[% END %]
[% END %]
</table>
Again, Template Toolkit code similar to the above already exists in the templates (for example, in the item_page_top.ttml template), so that editor reviews and ratings for each rating attribute will spring into existence if the corresponding columns are added to the Item, Supplier, or Member table, and are then populated by an editor. So you do not have to add anything to the templates for your editorial ratings and reviews to appear on the page. Here's roughly what the above Template Toolkit code would look like:
Scope
Search Weights And Re-IndexingThere is one important task that needs to be carried out if you add editorial review columns to your tables and also give them a search weight. Remember that by adding a search weight you are ensuring that your review text will be included in the body of text searched when a user types a keyword phrase into the search engine for that table. Each time a search weight is added to (or removed from) a column, the current text index on the table becomes invalidated, and you will receive an error message if you attempt to modify a record in the table. To fix this situation you must visit the Index control panel and re-index the entire table. In our example case, the Item table needs to be re-indexed. When you do this, the Item index tables are dropped and then recreated with the new searchable columns. Once the indexing is complete you will be able to add and modify Item records again. New editorial reviews will then be searchable when someone types a keyword phrase into the search box appearing on Category pages. Of course, the same re-indexing process would need to be carried out on the Supplier or Member tables if you added editorial review columns with search weights to either of those. Alternate Color SchemesIt is quite likely that you will not like the default editorial bigstars or the color scheme. A few alternate schemes can be found in the skins area of the distribution, along with the default editorial rating images. First up, in /rs/foundry/skins/default/images you will find the following default directories that store the rating images that are used depending on the style that is currently in effect: /bar_editor /bigstar_editor /color_editor /star_editor /therm_editor You can edit/replace any of the images in these directories to achieve to desired look for your editorial ratings. You will also find some additional directories that differ in name only in that they are appended with a integer. These directories are not used by the program, but contain alternate sets of images that might be of use to you (or not). By swapping the names of a pair of directories, such as: /bigstar_editor /bigstar_editor2 You can immediately get the alternate images in play. Make sure that any images you swap have the same names and physical dimensions as the existing ones (since image information is stored in the configuration files and needs to match up with what is found in the default image directories). Here are some alternate editorial rating image sets:
« Table of Contents | Obtain Review Foundry » Copyright © 2004 Random Mouse Software. All Rights Reserved. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||