Example #1
0
function ShowTemplate()
{
    global $ZoomInfo;
    global $OutputBuffers;
    global $TemplateShowTags;
    global $OUTPUT_TAG_COUNT;
    global $TemplateSearchFormTag, $TemplateSearchFormTagLen;
    global $TemplateDefaultTag, $TemplateDefaultTagLen;
    global $TemplateResultsTag, $TemplateResultsTagLen;
    global $OutputResultsBuffer;
    global $TemplateQueryTag, $TemplateQueryTagLen, $queryForHTML;
    // DO NOT MODIFY THE TEMPLATE FILENAME BELOW:
    $TemplateFilename = "search_template.html";
    // Note that there is no practical need to change the TemplateFilename. This file
    // is not visible to the end user. The search link on your website should point to
    // "search.php", and not the template file.
    //
    // Note also that you cannot change the filename to a PHP or ASP file.
    // The template file will only be treated as a static HTML page and changing the
    // extension will not alter this behaviour. Please see this FAQ support page
    // for a solution: http://www.wrensoft.com/zoom/support/faq_ssi.html
    //Open and print start of result page template
    $TemplateFilename = dirname(__FILE__) . "/" . $TemplateFilename;
    $template = file($TemplateFilename);
    $numtlines = count($template);
    //Number of lines in the template
    $template_line = 0;
    $templatePtr = $template[$template_line];
    while ($template_line < $numtlines && $templatePtr != "") {
        $tagPos = strpos($templatePtr, "<!--ZOOM");
        if ($tagPos === FALSE) {
            $tagPtr = "";
        } else {
            if ($tagPos == 0) {
                $tagPtr = $templatePtr;
            } else {
                print substr($templatePtr, 0, $tagPos);
                $tagPtr = substr($templatePtr, $tagPos);
            }
        }
        if ($tagPtr == "") {
            print $templatePtr;
            $templatePtr = "";
        } else {
            if (strncasecmp($tagPtr, $TemplateDefaultTag, $TemplateDefaultTagLen) == 0) {
                ShowDefaultSearchPage();
                $templatePtr = substr($tagPtr, $TemplateDefaultTagLen);
            } else {
                if (strncasecmp($tagPtr, $TemplateSearchFormTag, $TemplateSearchFormTagLen) == 0) {
                    ShowDefaultForm();
                    $templatePtr = substr($tagPtr, $TemplateSearchFormTagLen);
                } else {
                    if (strncasecmp($tagPtr, $TemplateResultsTag, $TemplateResultsTagLen) == 0) {
                        print $OutputResultsBuffer;
                        $templatePtr = substr($tagPtr, $TemplateResultsTagLen);
                    } else {
                        if (strncasecmp($tagPtr, $TemplateQueryTag, $TemplateQueryTagLen) == 0) {
                            if (strlen($queryForHTML) > 0) {
                                print $queryForHTML;
                            }
                            $templatePtr = substr($tagPtr, $TemplateQueryTagLen);
                        } else {
                            for ($tagnum = 0; $tagnum < $OUTPUT_TAG_COUNT; $tagnum++) {
                                $tagLen = strlen($TemplateShowTags[$tagnum]);
                                if (strncasecmp($tagPtr, $TemplateShowTags[$tagnum], $tagLen) == 0) {
                                    print $OutputBuffers[$tagnum];
                                    $templatePtr = substr($tagPtr, $tagLen);
                                    break;
                                }
                            }
                            if ($tagnum == $OUTPUT_TAG_COUNT) {
                                print $tagPtr;
                                $templatePtr = "";
                            }
                        }
                    }
                }
            }
        }
        if (strlen(trim($templatePtr)) == 0) {
            $template_line++;
            if ($template_line < $numtlines) {
                $templatePtr = $template[$template_line];
            }
        }
    }
}
function ShowTemplate()
{
    global $ZoomInfo;
    global $OutputBuffers;
    global $TemplateShowTags;
    global $OUTPUT_TAG_COUNT;
    global $TemplateSearchFormTag, $TemplateSearchFormTagLen;
    global $TemplateDefaultTag, $TemplateDefaultTagLen;
    global $TemplateResultsTag, $TemplateResultsTagLen;
    global $OutputResultsBuffer;
    global $TemplateQueryTag, $TemplateQueryTagLen, $queryForHTML;
    global $UseAutoComplete, $DateRangeSearch;
    global $AUTOCOMPLETE_JSFILE, $AUTOCOMPLETE_CSSFILE, $DATEPICKER_JSFILE;
    global $SelfURL, $LinkBackJoinChar;
    // DO NOT MODIFY THE TEMPLATE FILENAME BELOW:
    $TemplateFilename = "search_template.html";
    // Note that there is no practical need to change the TemplateFilename. This file
    // is not visible to the end user. The search link on your website should point to
    // "search.php", and not the template file.
    //
    // Note also that you cannot change the filename to a PHP or ASP file.
    // The template file will only be treated as a static HTML page and changing the
    // extension will not alter this behaviour. Please see this FAQ support page
    // for a solution: http://www.wrensoft.com/zoom/support/faq_ssi.html
    //Open and print start of result page template
    $TemplateFilename = dirname(__FILE__) . "/" . $TemplateFilename;
    $template = file($TemplateFilename);
    $numtlines = count($template);
    //Number of lines in the template
    $template_line = 0;
    $templatePtr = $template[$template_line];
    $IncludedJS = false;
    $NeedJS = false;
    if ($UseAutoComplete == 1 || $DateRangeSearch == 1) {
        $NeedJS = true;
    }
    while ($template_line < $numtlines && $templatePtr != "") {
        if ($NeedJS == true && $IncludedJS == false && stristr($templatePtr, "</head>") !== FALSE) {
            IncludeAdditionalJS();
            $IncludedJS = true;
        }
        $tagPos = strpos($templatePtr, "<!--ZOOM");
        if ($tagPos === FALSE) {
            $tagPtr = "";
        } else {
            if ($tagPos == 0) {
                $tagPtr = $templatePtr;
            } else {
                print substr($templatePtr, 0, $tagPos);
                $tagPtr = substr($templatePtr, $tagPos);
            }
        }
        if ($tagPtr == "") {
            print $templatePtr;
            $templatePtr = "";
        } else {
            if (strncasecmp($tagPtr, $TemplateDefaultTag, $TemplateDefaultTagLen) == 0) {
                ShowDefaultSearchPage();
                $templatePtr = substr($tagPtr, $TemplateDefaultTagLen);
            } else {
                if (strncasecmp($tagPtr, $TemplateSearchFormTag, $TemplateSearchFormTagLen) == 0) {
                    ShowDefaultForm();
                    $templatePtr = substr($tagPtr, $TemplateSearchFormTagLen);
                } else {
                    if (strncasecmp($tagPtr, $TemplateResultsTag, $TemplateResultsTagLen) == 0) {
                        print $OutputResultsBuffer;
                        $templatePtr = substr($tagPtr, $TemplateResultsTagLen);
                    } else {
                        if (strncasecmp($tagPtr, $TemplateQueryTag, $TemplateQueryTagLen) == 0) {
                            if (strlen($queryForHTML) > 0) {
                                print $queryForHTML;
                            }
                            $templatePtr = substr($tagPtr, $TemplateQueryTagLen);
                        } else {
                            for ($tagnum = 0; $tagnum < $OUTPUT_TAG_COUNT; $tagnum++) {
                                $tagLen = strlen($TemplateShowTags[$tagnum]);
                                if (strncasecmp($tagPtr, $TemplateShowTags[$tagnum], $tagLen) == 0) {
                                    print $OutputBuffers[$tagnum];
                                    $templatePtr = substr($tagPtr, $tagLen);
                                    break;
                                }
                            }
                            if ($tagnum == $OUTPUT_TAG_COUNT) {
                                print $tagPtr;
                                $templatePtr = "";
                            }
                        }
                    }
                }
            }
        }
        if (strlen(trim($templatePtr)) == 0) {
            $template_line++;
            if ($template_line < $numtlines) {
                $templatePtr = $template[$template_line];
            }
        }
    }
    // Last check if we didn't add the JS (because of a lack of </head>, we will insert it before end of file
    if ($NeedJS == true && $IncludedJS == false) {
        IncludeAdditionalJS();
        $IncludedJS = true;
    }
}