Site Search
sitemap • search tips • faqs 
LOG-IN
SUBSCRIBE
PACKAGES
FEATURES
CUSTOMERS
ABOUT US
SUPPORT
Frequently Asked Question #53
How does the FusionBot template object's IF / ENDIF logic work?
For implementers of a Custom Template file, there may be times when you do not wish for certain HTML tags within your template to be printed, such as when the value of a specific template object tag is NULL, when the object text represents text, or 0, when the object tag represent a numeric value.

IF / ENDIF logic may be used for any valid template object tag. Also, for even greater control, you may nest IF / ENDIF blocks within one another. Following is the basic syntax of an IF / ENDIF block:

$LGK_OBJECT_NAME_IF

    <BR>
    <font face="arial">$LGK_OBJECT_NAME</font>
    <BR>

$LGK_OBJECT_NAME_ENDIF

When the FusionBot template parser encounters the beginning of an IF block for a specific object, as denoted by the value of OBJECT_NAME, it will only print the contents between the IF and ENDIF syntax when the value of the specified OBJECT_NAME called within the block is NOT NULL.

When creating an IF / ENDIF block, the parser expects to find a corresponding template object tag within it. If the parser does not find the corresponding object tag within the block, the entire contents of the block will be ignored, regardless of the value of the corresponding object tag.

For example, in the following template code, if the value of the FusionBot template object $LGK_MATCHED is NULL, not only will no output be printed in place of the object tag, the HTML tags contained within the IF / ENDIF block will not be printed either. This prevents unnecessary HTML tags from being included in your output that may otherwise cause improper formatting of your results:

$LGK_MATCHED_IF

    <BR>
    <font face="arial">$LGK_MATCHED</font>
    <BR>

$LGK_MATCHED_ENDIF

In this example, the $LGK_MATCHED object returns the text line describing the number of documents that the query performed has "matched", such as:

Matched 59 pages in 0.01 seconds

When no matching search terms exist for a keyword, the value of $LGK_MATCHED is NULL, which will cause the text and object tags within the IF block NOT to print.

You can further extend the functionality of the IF/ENDIF logic by including an ELSE clause as well. When using the ELSE clause, when the value of the corresponding template object tag is NULL or 0, the contents within the ELSE block will be printed, rather than the contents of the IF block:

$LGK_MATCHED_IF

    <BR>
    <font face="arial">$LGK_MATCHED</font>
    <BR>

$LGK_MATCHED_ELSE

    <BR>
    Your Search for: $LGK_KEYS, resulted in no results.
    <BR>

$LGK_MATCHED_ENDIF

Again, the most important requirement to remember is that whenever using any IF logic within your template, the corresponding object tag which you are evaluating for MUST be present within the IF block of code, in order to function correctly.

More information on all available FusionBot Template Object Tags, and their use, please reference our Template Object Documentation PDF.


If you did not find an answer to your question, please return to the Support Page and fill out the form provided.


 Featured Customers:
  • Coca-Cola Enterprises
  • Rezidor Hotel Group
  • Covenant Health Products
  • American Electric Power
  • Everywherechair
  • Fleet Safety Equipment, Inc.
  • HandsOnTools
  • Chemglass Life Sciences
  • MerckSerono
  • R-JetTek Inkjet Technology Solutions
  • Madison Gas and Electric
  • TwitterGadget
  • True Beer
  • Galaxy.com
  • Capital Tractor
  • adamanta
  • BBQ Island Outdoor Products
  • Battery Clerk
  • DCU - Digital Federal Credit Union
  • BJJ Sports
  • National Center for Missing and Exploited Children

[Subscribe to FusionBot - Site Search & Sitemap Solutions]
Copyright 1998 - 2016 LOGIKA Corporation. All rights reserved.
[about site search] [advertising] [build vertical search engine] [reseller program] [popular searches] [top clicks] [terms of use] [uptime]