why isn't the php getting parsed on this page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bruceg
Forum Contributor
Posts: 174
Joined: Wed Mar 16, 2005 11:07 am
Location: Morrisville, NC
Contact:

why isn't the php getting parsed on this page

Post by bruceg »

I created a search page with PHP (Zoom Search) and for some reason the rest of the PHP I was using doesn't get parsed as HTML. It stays as PHP code.

The page is http://www.inspired-evolution.com/search.php

and the non functioning php code can be seen in the source code.

Any thoughs on why this would be happening?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it'd help to see the actual code creating the page unless that's it. In which case, it would appear php is not processing your code at all.
bruceg
Forum Contributor
Posts: 174
Joined: Wed Mar 16, 2005 11:07 am
Location: Morrisville, NC
Contact:

Post by bruceg »

The search page.php itself has so much code, it won't allow me to copy and paste. The search template code which contains the PHP code that doesn't work is below.

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
<head>
<meta http-equiv="Content-type" content="text/html; charset=ISO-8859-1" />
<title>Inspired Evolution : : Search this Site</title>
<?php require('includes/meta_tags.inc'); ?>
<link rel="shortcut icon" href="http://www.inspired-evolution.com/favicon.ico" /> 
<link rel="stylesheet" href="Gilbert.css" type="text/css" media="screen, handheld" />
<link rel="alternate" type="application/rss+xml" title="RSS news feed " href="http://www.inspired-evolution.com/RSS/Inspired-Evolution.xml" />
<script type="text/javascript" src="javascript/Google_Analytics.js"></script>
</head>
</head>

<body>
	<!-- 
	The ZOOMSEARCH tag below marks the place where your search form and search results
	will be inserted when you run the search script. By default, you do not need to place a 
	search form here, the search script will generate one and display it before the search 
	results. Also note that the ZOOMSEARCH tag should be on a seperate line of its own.
	-->
	<!-- begin outer wrapper div --> 

<div id="wrapper_outer">
<a class="skiplink" href="#startcontent">Skip over navigation</a>

<!-- begin header div --> 
<div id="header"><?php require ('rotate.php'); ?><?php showImage () ;?></div>
<!-- old browser help -->
<div class="hide">
  <p>This site has been designed to look in best in a browser that supports <a href="http://www.webstandards.org/upgrade/" 
  title="Download a browser that complies with Web standards.">web standards</a>.</p>
</div>
<!-- top nav list --> 
<div id="navcontainer">
<ul id="navlist">
<li class="first"><a href="About_Me.php" title="you know you want to learn more about me">About Me</a></li>
<li><a href="Skillset.php" title="I've got skillz">Skill set</a></li>
<li><a href="Hireme.php" title="I can do wonders for your web presence">Hire Me</a></li>
<li><a href="Portfolio.php" title="web sites, graphics, newsletters">Portfolio</a></li>
<li><a href="Contact.php"  title="how to get in touch with me">Contact</a></li>
<li><a href="Resume.php"  title="my beautiful resume">R&eacute;sum&eacute;</a></li>
<li><a href="http://inspiredevolution.blogs.com/inspiredevolutioncom/"  title="the blog for Inspired-Evolution.com" >Blog</a></li>
<li class="last"><a href="RSS.php"  title="Syndication that is really simple" >RSS</a></li>

</ul>
</div>
<!-- inner content wrapper div --> 
<div id="wrapper_inner">
<!-- breadcrumbs div --> 
<div id="breadcrumbs"><a href="index.php" title="home link" accesskey="h">Home</a>  > >  Search

</div>
<!-- text div --> 
<div id="main_content">
<a name="startcontent" id="startcontent"></a>
	<h1 title="search this site">Search this site</h1>
	<div id="search">
	<p>
	Enter one or more keywords to search for using the Zoom Search Engine.<br />
	Note that '*' and '?' wildcards are supported.
	</p>
	</div>	
	<!--ZOOMSEARCH-->	
	<div id="validation">
<?php require('includes/buttons.inc'); ?>
</div>
<div id="print">
		  <a href="#" onclick="javascript:
window.print();"><img src="images/printButton.png" alt=
"Print this page" style="height: 18px; width: 18px;" /></a>
		</div>

<div id="bottom_links2"><ul id="horizontal_list2"><li><a href="Sitemap.php" title="Site Map">Site Map</a></li><li><a href="Recent_Updates.php" title="Recent Updates">Recent Updates</a></li><li><a href="About_This_Site.php" title="About this site">About This Site</a></li><li><a href="FAQ.php" title="links to FAQ page"><abbr title="Frequently Asked Questions"> FAQ</abbr></a></li><li><a href="CSS_tips.php" title="links to page chocked full of great CSS tips"> CSS tips</a></li><li><a href="Accessibility.php" title="Accessibility">Accessibility</a></li><li><a href="Link_Exchange.php" title="Link Exchange">Link Exchange</a></li><li><a href="SEO.php" title="SEO"><abbr title="search engine optimization">SEO</abbr></a></li></ul></div>
<div id="clear">&nbsp;</div>
</div>

<!-- begin footer --> 
<div id="footer">
<p class="footertag">Inspired-Evolution - Web Site: Design, Development, Marketing for Raleigh/Durham, Chapel Hill, Cary, North Carolina.</p>

<?php require('includes/footer.inc'); ?>
<span class="date"><?
$last_modified = filemtime("search_template.php");
print("Last Modified ");
print(date("m/j/y h:i", $last_modified));
?></span>
</div>

</div>
</div>

</body>

</html>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

how are you loading/parsing this "template" ?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

EDITED: That's what I get for not looking before posting...

Like Feyd asked, what are you doing to parse the template?
bruceg
Forum Contributor
Posts: 174
Joined: Wed Mar 16, 2005 11:07 am
Location: Morrisville, NC
Contact:

Post by bruceg »

This file is doing it I believe...

other than this file and the template file, there is the search php code itself which is another file.

Code: Select all

<?php

// WARNING: DO NOT EDIT THIS FILE.
// This file is automatically generated by the Zoom Indexer application
// and will be updated each time you re-index your site. You should make all
// setting changes directly from the Indexer, via the Configuration window.
// 
// If you wish to modify the text messages such as "Search results for...",
// etc. then look up "Zoom Language Files" or "Translating the search page"
// in the Users Guide for information.

$UseUTF8 = 0;
$Charset = "windows-1252";
$MapAccents = 0;
$MinWordLen = 2;
$Highlighting = 0;
$HighlightLimit = 1000;
$GotoHighlight = 0;
$TemplateFilename = "search_template.php";
$FormFormat = 2;
$Logging = 0;
$LogFileName = "./logs/searchwords.log";
$MaxKeyWordLineLen = 256;
$MaxDictIDLen = 2;
$NumKeywords = 1686;
$NumPages = 42;
$DictReservedLimit = 32;
$DictReservedPrefixes = 21;
$DictReservedSuffixes = 12;
$DictReservedNoSpaces = 27;
$WordSplit = 1;
$ZoomInfo = 1;
$Timing = 0;
$DefaultToAnd = 0;
$SearchAsSubstring = 0;
$ToLowerSearchWords = 1;
$ContextSize = 30;
$MaxContextKeywords = 3;
$AllowExactPhrase = 0;
$UseLinkTarget = 0;
$UseDateTime = 0;
$WordJoinChars = "._-'";
$Spelling = 0;
$UseCats = 0;
$DisplayNumber = 1;
$DisplayTitle = 1;
$DisplayMetaDesc = 1;
$DisplayContext = 1;
$DisplayTerms = 1;
$DisplayScore = 1;
$DisplayURL = 1;
$DisplayDate = 1;
$Version = "Version 4.2 (1002)";
$STR_FORM_SEARCHFOR = "Search for:";
$STR_FORM_SUBMIT_BUTTON = "Submit";
$STR_FORM_RESULTS_PER_PAGE = "Results per page:";
$STR_FORM_CATEGORY = "Category:";
$STR_FORM_CATEGORY_ALL = "All";
$STR_FORM_MATCH = "Match:";
$STR_FORM_ANY_SEARCH_WORDS = "any search words";
$STR_FORM_ALL_SEARCH_WORDS = "all search words";
$STR_NO_QUERY = "No search query entered.";
$STR_RESULTS_FOR = "Search results for:";
$STR_RESULTS_IN_ALL_CATEGORIES = "in all categories";
$STR_RESULTS_IN_CATEGORY = "in category";
$STR_POWEREDBY = "Search powered by";
$STR_NO_RESULTS = "No results";
$STR_RESULT = "result";
$STR_RESULTS = "results";
$STR_PHRASE_CONTAINS_COMMON_WORDS = "The following phrase contains very common words on this site, resulting in a limited search. Please define a more specific phrase for better results.";
$STR_SKIPPED_FOLLOWING_WORDS = "The following word(s) are in the skip word list and have been omitted from your search:";
$STR_SKIPPED_PHRASE = "Note that you can not search for exact phrases beginning with a skipped word";
$STR_SUMMARY_NO_RESULTS_FOUND = "No results found.";
$STR_SUMMARY_FOUND_CONTAINING_ALL_TERMS = "found containing all search terms.";
$STR_SUMMARY_FOUND_CONTAINING_SOME_TERMS = "found containing some search terms.";
$STR_SUMMARY_FOUND = "found.";
$STR_PAGES_OF_RESULTS = "pages of results.";
$STR_POSSIBLY_GET_MORE_RESULTS = "You can possibly get more results searching for";
$STR_ANY_OF_TERMS = "any of the terms";
$STR_ALL_CATS = "all categories";
$STR_DIDYOUMEAN = "Did you mean:";
$STR_SORTEDBY_RELEVANCE = "Sorted by relevance";
$STR_SORTBY_RELEVANCE = "Sort by relevance";
$STR_SORTBY_DATE = "Sort by date";
$STR_SORTEDBY_DATE = "Sorted by date";
$STR_RESULT_TERMS_MATCHED = "Terms matched: ";
$STR_RESULT_SCORE = "Score: ";
$STR_RESULT_URL = "URL:";
$STR_RESULT_PAGES = "Result Pages:";
$STR_RESULT_PAGES_PREVIOUS = "Previous";
$STR_RESULT_PAGES_NEXT = "Next";
$STR_SEARCH_TOOK = "Search took";
$STR_SECONDS = "seconds";
?>
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

What is the name of the template you posted (filename and extension)? Also, is it being called by include or is it being parsed through a function?
bruceg
Forum Contributor
Posts: 174
Joined: Wed Mar 16, 2005 11:07 am
Location: Morrisville, NC
Contact:

Post by bruceg »

it is search_template.php.

I think the first part of the search code page calls the template

Code: Select all

if(strcmp('4.0.0', phpversion()) > 0)
    die("This version of the script requires PHP 4.0.0 or higher.<br />");

require("settings.php");

// Check for dependent files
if (!file_exists("settings.php") || !file_exists("zoom_wordmap.zdat") || !file_exists("zoom_dictionary.zdat")
    || !file_exists("zoom_pages.zdat") || !file_exists("zoom_titles.zdat"))
{
    print("<b>Zoom files missing error:</b> Zoom is missing one or more of the required index data files.<br />Please make sure the generated index files are uploaded to the same path as this search script.<br />");
    return;
}

if ($Spelling == 1 && !file_exists("zoom_spelling.zdat"))
    print("<b>Zoom files missing error:</b> Zoom is missing the 'zoom_spelling.zdat' file required for the Spelling Suggestion feature which has been enabled.<br />");

// ----------------------------------------------------------------------------
// Settings
// ----------------------------------------------------------------------------

// The options available in the dropdown menu for number of results
// per page
$PerPageOptions = array(10, 20, 50, 100);

/*
// For foreign language support, setlocale may be required on the server for
// wildcards and highlighting to work. Uncomment the following lines and specify
// the appropriate locale information
//if (setlocale(LC_ALL, "ru_RU.cp1251") == false) // for russian
//  print("Failed to change locale setting or locale setting invalid");
*/
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

that hasn't told me anything on how the search page is being parsed. You've posted nothing that would suggest the search page loading the template.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

OK, so now we know that the template is called somefile.php. Now, where in your script does it get called/included/parsed and how is that process done?
bruceg
Forum Contributor
Posts: 174
Joined: Wed Mar 16, 2005 11:07 am
Location: Morrisville, NC
Contact:

Post by bruceg »

I emailed the guy at wrensoft who developed the code and got my answer.

something like this does the trick

Code: Select all

<?php virtual("header.html"); ?>
Welcome to my search page
<?php virtual("search.php"); ?>
...
<?php virtual("footer.php"); ?>
User avatar
mattcooper
Forum Contributor
Posts: 210
Joined: Thu Mar 17, 2005 5:51 am
Location: London, UK

Post by mattcooper »

I have just read this topic with immense interest, and would like to add to Bruce's last post the fact that "the guy from Wrensoft" (David Wren) is an absolute gem.

I had some similar issues with ZoomSearch last year and emailed David, who replied by telephone from Melbourne Australia within half an hour with the solution to the problem.

ZoomSearch is a piece of software that can only be highly recommended, as can the level of service offered by it's creator. Let's hope that all OSS is offered in the same spirit in the coming years...

Nice choice, Bruce!!
Post Reply