FirstProductions Dining Guide 2.0 Documentation
Overview · License and Copyright · Installation and Requirements · Template Customization · Troubleshooting · Release Changes and History · Future Plans


Templates
The output of FirstProductions Dining Guide can be customized completely by templates. These templates can be found in the template directory. Below is a list of the templates and what they do. Main page templates are in
red. The other templates customize the main templates.

TEMPLATE NAME DESCRIPTION
copyright.txt Chef Moz copyright notice. Under the Chef Moz Licence Agreement, this must be present on all pages using Chef Moz data.
editor.txt The Editor Profile page showing the profile of an editor.
fullsearch.txt The "Full Search" box, with all restaurant-searching options.
links.txt The format for each item on the list of links for a restaurant, used on restaurant_page.txt.
main.txt The main "Regions" page, showing all of the different continents/countries represented in FirstProductions Dining Guide. Nothing is retrieved from Chef Moz when showing this page.
nearby_cities.txt The format for each nearby city listed on restaurants.txt and places.txt.
nomatches.txt The page shown when there are no matches to a restaurant search.
online_guides.txt The format for each online guide listed on places.txt.
place_list.txt The format for each place listed on places.txt.
places.txt A page listing the cities, states, neighborhoods, or regions of a particular area.
quicksearch.txt The "Quick Search" box, with minimal restaurant-searhing options.
restaurant_listing.txt The format for each restaurant listed on restaurants.txt.
restaurant_page.txt The page showing all of the details of a restaurant, including contact information, links, reviews, and more.
restaurants.txt A page listing the restaurants located in a city or neighborhood.
reviews.txt The format for each review for a restaurant, used on restaurant_page.txt.
search.txt The restaurant search results page. If no matches are found, nomatches.txt is displayed instead.

There is also a directory called include in the template directory. Custom files that you want to be able to insert into a template, such as a header or footer, go in this folder. An example header and footer file are already included in this folder. Information on including these files in your templates will be discussed later on.

Customization of Main Page Templates
The Insert Command
When customizing the templates for the main pages, special tags will be converted by FirstProductions Dining Guide into content. The [insert VARIABLE] tag, where VARIABLE is the name of a valid content variable, will be replaced with that contents of that content variable. This tag can only be used on main page templates and the quicksearch.txt and fullsearch.txt templates, but those two templates should not need customization. Below is a list of content varialbes that can be used in the [insert] tag, and what templates they are available on. Items in
red can be "set," which will be explained later. The templates used in the table are abbreviated: EDITOR, FULLSEARCH, MAIN, NOMATCHES, PLACES, QUICKSEARCH, RESTAURANT_PAGE, RESTAURANTS, and SEARCH.

CONTENT VARIABLE ED FS MA NM PL QS RP RS SE DESCRIPTION
ACCEPTS             X     Payment types accepted by the restaurant
ADD_CHANGE_INFO             X     URL to the Add/Change Info link
ADD_LINK             X     URL to the Add a Link link
ALCOHOL             X     Restaurant's alcohol service/policy
ALPHA_LIST         X         A long strip of letters, when used by Chef Moz
CATEGORY         X   X X   Current category, with the text as links
CONTACT_INFO             X     All of the restaurant's contact information
COPYRIGHT X   X X X   X X X The Chef Moz copyright bar
CUISINE             X     The restaurant's cuisine(s), up to three
DELIVERY_PAGE             X     URL to the restaurant's delivery page
DESCRIPTION             X     Description of the restaurant
DRESS             X     Suggested/required attire for the restaurant
EDITOR X                 The name of the editor
EDITORS         X   X X   The category's editor(s)
EMAIL             X     The restaurant's email address
FEATURES             X     Features that the restaurant offers
FULLSEARCH X   X X X   X X X The Full Search box with all search options
HANDICAPPED_ACCESS             X     Handicapped accessibility - sometimes has explanation
HOURS             X     Hours that the restaurant is open
ID             X     Chef Moz's ID for the restaurant
IMAGE-H             X     Hight of the picture of the restaurant
IMAGE-SRC             X     URL of the picture of the restaurant
IMAGE-W             X     Width of the picture of the restaurant
LINKS             X     List of links to reviews of the restaurant
LOGO-H             X     Hight of the restaurant's logo
LOGO-SRC             X     URL of the restaurant's logo
LOGO-W             X     Width of the restaurant's logo
MATCHES_FOUND                 X Number of restaurant matches found
MATCHES_SHOWING                 X Number of restaraunt matches showing (e.g. 1-20)
MENU_PAGE             X     URL to the restaurant's online menu
MORE_RESULTS               X   More Results bar to show more restaurants
MORE_REVIEWS             X     More Reviews bar to show more restaurant reviews
NEARBY_CITIES         X     X   List of nearby cities
NEIGHBORHOODS         X         List of neighborhoods
NEXT_LINK                 X URL for the Next link
NUM_PER_PAGE               X   Number of Restaurants to Show per Page bar
ONLINE_GUIDES         X         List of online guides
PARKING             X     List of ways to park at the restaurant
PLACES         X         List of places, in columns with [set]
PREVIOUS_LINK                 X URL for the Previous link
PRICE_BREAKFAST             X     Price, in price symbols (see price key) for breakfast
PRICE_DINNER             X     Price, in price symbols (see price key) for dinner
PRICE_KEY               X   Price key showing what the price symbols stand for
PRICE_LUNCH             X     Price, in price symbols (see price key) for lunch
PROFILE X                 Profile of the editor
QUICKSEARCH X   X X X   X X X The Quick Search box with minimal search options
RATING_AMBIANCE             X     Ambiance rating, as a number
RATING_AMBIANCE1             X     Ambiance rating, as stars only, no gray stars
RATING_AMBIANCE2             X     Ambiance rating, as stars and gary stars (always five)
RATING_FOOD             X     Food rating, as a number
RATING_FOOD1             X     Food rating, as stars only, no gray stars
RATING_FOOD2             X     Food rating, as stars and gary stars (always five)
RATING_OVERALL             X     Overall rating, as a number
RATING_OVERALL1             X     Overall rating, as stars only, no gray stars
RATING_OVERALL2             X     Overall rating, as stars and gary stars (always five)
RATING_SERVICE             X     Service rating, as a number
RATING_SERVICE1             X     Service rating, as stars only, no gray stars
RATING_SERVICE2             X     Service rating, as stars and gary stars (always five)
RESERVATIONS             X     Restaurant's reservations phone number
RESERVATIONS_PAGE             X     URL to the restaurant's reservations page
RESTAURANT_NAME             X     Name of the restaurant
RESTAURANTS               X   List of restaurants in a location
REVIEW_IT_LINK             X     URL for the Review It link
REVIEWS             X     Review(s) of the restaurant
REVIEWS_PER_PAGE             X     Reviews per Page bar
SEARCH_CITY   X               City that was last searched for
SEARCH_QUERY   X               Query that was last searched for
SEARCH_RESULTS                 X The restaurant search results
SMOKING             X     The restaurant's smoking policy
WEB_PAGE             X     URL to the restaurant's web site

Another feature of the [insert] tag is the ability to control the output's capitalization, using the format: [insert VARIABLE case="CASE"], where VARIABLE is the name of a valid content variable, and CASE is either U or L for uppercase and lowercase respectively. Note: the quotation marks are optional.

The Set Command
Besides the [insert] tag, there are other tags that you can use, such as the [set] tag. The set tag allows you to specify a piece of HTML code to separate each item stored in the variable. For example, this could put a new line between each variable (<br>) or a comma and space (, ) between them. Be careful! Not specifying a [set] tag for a varialbe that can be set will cause a pipe (|) to separate the values. You can keep the default [set] tags that are in the template unless you modify part of the template dealing with the varialbe, or if you just want to. This is the format of the [set] tag: [set]VARIABLE=SEPARATER|VARIABLE=SEPARATER|VARIABLE=SEPARATER[/set], where VARIABLE is the the variable to be "set" and SEPARATER is the piece of HTML code to separate each value. If you want to use the equal sign (=) as part of the SEPARATER portion, put a backslash before it (\=). Multiple VARIABLE=SEPARATERs can be placed in the same [set] tag if you separate them with a pipe (|), or you can use multiple [set] tags.

The Var Command
Another tag you can use is the [var] tag, which allows you to put a script varialbe into the template. It is used in the format: [var VARIABLE], where VARIABLE is the script variable to be inserted. Below is a list of script varaibles that can be used with the [var] tag.

SCRIPT VARIABLE DESCRIPTION
SITE_TITLE Title of your site or dining guide
SCRIPT_URL The complete URL of the guide.cgi script
CGI_URL The path to the folder that guide.cgi is in, located in the CGI-BIN
SCRIPT_NAME The name of the script (default: guide.cgi)
STAR The URL of the star graphic
GRAY_STAR The URL of the grayed star graphic
TOP_LOCATION Used to create regional dining guides
TOP_TITLE Customizes the text "Top" on the dining guide pages.
RESTRICT_CITY Restricts searches to a specific city
RESTRICT_STATE Restricts searches to a specific state
RESTRICT_COUNTRY Restricts searches to a specific country

Like the [insert] tag, you can also control the capitalization of the [var] tag using the format: [var VARIABLE case="CASE"], where VARIABLE is the script variable name to be inserted and CASE is either U or L for uppercase and lowercase respectively. Note: the quotation marks are optional.

The Include Command
As mentioned earlier, there is an include directory in the templates directory that you can put files in, such as a header or footer file, that can be inserted into a template. This is done using the [include] tag: [include FILE], where FILE is the name of a .txt file in the include directory. Do not include the .txt on the end of the filename; it will be automatically added.

The If Command
Finally, there is the [if] tag. The [if] tag allows you to have a conditional block of code, which will be shown if the condition is met. Here are the valid [if] tags, where the MODULEs are valid content varialbes (ones used in the [insert] tag), and CODE is the conditional code, that will be shown if the condition is met.

[if] TAG MEANING (in Perl code)
[if MODULE or MODULE or MODULE or MODULE and not MODULE]CODE[/if] if(MODULE || MODULE || MODULE || MODULE && !MODULE){CODE}
[if MODULE or MODULE or MODULE and not MODULE]CODE[/if] if(MODULE || MODULE || MODULE && !MODULE){CODE}
[if MODULE or MODULE and not MODULE]CODE[/if] if(MODULE || MODULE && !MODULE){CODE}
[if MODULE or MODULE or MODULE or MODULE and MODULE]CODE[/if] if(MODULE || MODULE || MODULE || MODULE && MODULE){CODE}
[if MODULE or MODULE or MODULE and MODULE]CODE[/if] if(MODULE || MODULE || MODULE && MODULE){CODE}
[if MODULE or MODULE and MODULE]CODE[/if] if(MODULE || MODULE && MODULE){CODE}
[if MODULE or MODULE]CODE[/if] if(MODULE || MODULE){CODE}
[if not MODULE and not MODULE]CODE[/if] if(!MODULE && !MODULE){CODE}
[if not MODULE and MODULE]CODE[/if] if(!MODULE && MODULE){CODE}
[if MODULE and not MODULE]CODE[/if] if(MODULE && !MODULE){CODE}
[if MODULE and MODULE]CODE[/if] if(MODULE && MODULE){CODE}
[if not MODULE]CODE[/if] if(!MODULE){CODE}
[if MODULE]CODE[/if] if(MODULE){CODE}
[if not exists VAR]CODE[/if] if(!VAR){CODE}
[if exists VAR]CODE[/if] if(VAR){CODE}

Order of Evaluation
If you put a [var] tag in a include file, will it be evaluated or left as text? To find out, you need to know the order in which the commands are evaluated. This order, called the Order of Evaluation, is listed below. Number 1 is evaluated first, then number 2, and so on.

Number Command
1 set
2 include
3 insert
4 var
5 if

So in answer to the original question, yes, the [var] tag will be evaluated because the [include] tag is evaluated first, then the [var] tag. By the way, to insert a bracket at anytime into a template where it may interfere with a command, simply refer to the table below.

Use... To Insert...
%%BRACKET1%% [
%%BRACKET2%% ]

Customization of Other Templates
The other templates are not customized the same way as the main page templates. Variables in the form: %%VARIABLE%% are used to specify where content is placed into them. Each "other template" has their own set of valid variables that may be inserted. They are listed in tables below. Remember, when using these varialbes, put two percent signs (%%) on each side of the varialbe name. For a description of what each of these templates is for, see the beginning of this page.

copyright.txt
Variable Description
CAT The current category
ID Chef Moz's ID of the current page

links.txt
Variable Description
CHANGE_LINK URL to a page to change the link
SOURCE Author of the linked review
TITLE Title of the linked review
URL URL of the linked review

nearby_cities.txt
Variable Description
NAME The name of the nearby city
URL The URL to that city's page in the dining guide

online_guides.txt
Variable Description
DESCRIPTION Description of the online guide
NAME Name of the online guide
URL URL to the online guide

place_list.txt
Variable Description
INFO Dining guide statistics about that place
NAME Name of the place
URL URL to that place in the dining guide

restaurant_listing.txt
Variable Description
ADDRESS Address of the restaurant
CUISINE The restaurant's cuisine
NAME The name of the restaurant
NUM_LINKS The number of linked reviews
NUM_REVIEWS The number of reviews
PHONE The restaurant's phone number
PRICE The restaurant's price symbol
URL URL to the restaurant's dining guide page

reviews.txt
Variable Description
EMAIL_ADDRESS Reviewer's email address
HEADLINE Review's headline
NAME Name of the reviewer
RATING_AMBIANCE Ambiance rating
RATING_FOOD Food rating
RATING_OVERALL Overall rating
RATING_SERVICE Service rating
RECOMMENDED_DISHES Reviewer's recommended dishes
REVIEW The actual review of the restaurant

Navigation:
Overview · License and Copyright · Installation and Requirements · Template Customization · Troubleshooting · Release Changes and History · Future Plans
FirstProductions Dining Guide Web Site