PDA

View Full Version : XML error


paullind
01-17-2004, 01:59 PM
I am using the page search.php in the root of phpdig folder.

I then try to perform a search . If there are no results it seems to be ok, but when there are results to display I get this error:

The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.

I am using Windows2000 IIS. I noticed in a similar post that this may be a safe_mode issue so I checked php.ini and they are set to off (safe_mode and safe_mode_gid)

Is it a server/safe mode issue or just a newbie XML problem ?
(I am XML challenged at the moment)

Any input would be greatly appreciated.

Paul L
cdncc@cdncc.com

paullind
01-18-2004, 06:49 AM
this was the next line from the error page , i forgot to include it in the original post:

Only one top level element is allowed in an XML document. Error processing resource 'http://me.homeunix.org/phpdig/search.php?template_demo=.%2Ftemplates%2Fphpdig.html&site=0&path=&result_page=search.php&query_string=cdn&search=Go...&limite=10&option=start'. Line 2, Position 2

<b>Notice</b>: Undefined variable: match_this_spot in <b>c:\inetpub\wwwroot\phpdig\libs\search_function.php</b> on line <b>332</b><br />
-^

Charter
01-18-2004, 09:02 AM
Hi. In the search_function.php file, change:

if(eregi($reg_strings,$extract_content)) {
$match_this_spot = str_replace('<','&lt;',str_replace('>','&gt;',trim($match_this_spot)));
$match_this_spot = eregi_replace($reg_strings,"\\1<\\2>\\3",$extract_content);
$first_bold_spot = strpos($match_this_spot,"<");
$first_bold_spot = max($first_bold_spot - round((SNIPPET_DISPLAY_LENGTH / 2),0), 0);
$extract_content = substr($extract_content,$first_bold_spot,max(SNIPPET_DISPLAY_LENGTH, 2 * strlen($query_string)));
$extract .= ' ...'.phpdigHighlight($reg_strings,str_replace('<','&lt;',str_replace('>','&gt;',trim($extract_content)))).'... ';
$num_extracts++;
}

to the following:

if(eregi($reg_strings,$extract_content)) {
$extract_content = str_replace('<','&lt;',str_replace('>','&gt;',trim($extract_content)));
$match_this_spot = eregi_replace($reg_strings,"\\1<\\2>\\3",$extract_content);
$first_bold_spot = strpos($match_this_spot,"<");
$first_bold_spot = max($first_bold_spot - round((SNIPPET_DISPLAY_LENGTH / 2),0), 0);
$extract_content = substr($extract_content,$first_bold_spot,max(SNIPPET_DISPLAY_LENGTH, 2 * strlen($query_string)));
$extract .= ' ...'.phpdigHighlight($reg_strings,$extract_content).'... ';
$num_extracts++;
}

Remember to remove any "word" wrapping in the above code.

paullind
01-18-2004, 01:28 PM
Thanks Charter-Administrator

that did the trick !!!