Jump to content

Whats wrong with the 2 file paths in this fucntion?


worldcomingtoanend

Recommended Posts

I am setting up a php search engine that uses an xml file.  I have this long php code and when i run it I get an error on . '<a href="' . $hit["VISIBLEPATH"] . '">';  and an error on  $content = '<img src="'.$imageArray[$contentType].'" alt="'.$contentType.'" />';  basically its saying the file path is wrong and after what i hv done so far I am totally clueless whats going on. Thanks for your help.

 

function endElement($parser, $name)

{

   global $imageArray;

   global $hit;

   if ($name == "RECORD") {

     $score = number_format(($hit["SCORE"] * 100), 1, '.', " ");

     print '<tr>

                <td> </td>

                <td align="left" valign="top">'

                .'['.$score.'%] </td>'

                . '<td>'

                . '<a href="' . $hit["VISIBLEPATH"] . '">';

      if (empty($hit["TITLE"])) {

          $path=$hit["VISIBLEPATH"];

          ereg ("/(.*)/(.*)", $path, $regs);
          print $regs[2];
      } else {

          print $hit["TITLE"];

      }

      print '</a>  (' . $hit["LASTCHANGED"] . ')</td>';

      $contentType=strtoupper($hit["CONTENTTYPE"]);

      if (isset($imageArray[$contentType])) {

           $content = '<img src="'.$imageArray[$contentType].'" alt="'.$contentType.'" />';

      } else {

          $content = " ";

      }

      print '<td>'. $content.'</td><td></td></tr>'

                . '<tr>

                    <td></td>

                    <td colspan="3">'

                    .$hit["SUMMARY"]

           . '</td><td></td></tr>';

      print '<td></td><td colspan="3">'.substr($hit["VISIBLEPATH"], 0, 100) .'</td><td></td></tr>'

           . '<tr><td colspan="5"> </td></tr>'

           . '<tr><td></td><td height="1" class="line" colspan="3"></td><td></td></tr>'

           . '<tr><td colspan="5"> </td></tr>';



   }

}

Well, all I can say personally I never head of VISIBLEPATH as an element, unless its defined else where in your script. Which that be the case I am assuming theres a place to set that definition up to your server., then the imagearray.. portion of the img scr. I am thinking but just quickly looking at it, I am going to say is just calling the extension itself of the image being pulled for it, and not the nameofthefile.ext but thats me, Im just quickly guessing based off a glance through.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.