开发者

php4 xml output not displaying html

I'm really not liking my experience with php but I think it is a learning curve. Can someone look at my code and let me know why my html tags don't show for some of开发者_JAVA技巧 my classes?

  $g_books = array();
  $g_elem = null;

  function startElement( $parser, $name, $attrs ) 
  {

  global $g_books, $g_elem;
  if ( $name == 'AFFILIATEXML' ) 
  {
    $g_books []= array();
    }
  $g_elem = $name;
  }

  function endElement( $parser, $name ) 
  {
  global $g_elem;
  $g_elem = null;
  }

  function textData( $parser, $text )
  {
  global $g_books, $g_elem;
  if ( $g_elem == 'PRODUCTID' ||
  $g_elem == 'PRODUCTNAME' ||
  $g_elem == 'PRODUCTPRICE' ||
  $g_elem == 'CLASS_DATE'||
  $g_elem == 'LONGDESCRIPTION')
  {
  $g_books[ count( $g_books ) - 1 ][ $g_elem ] = $text;
  }
  }

  $parser = xml_parser_create();

  xml_set_element_handler( $parser, "startElement", "endElement" );
  xml_set_character_data_handler( $parser, "textData" );

  $f = fopen( 'http://webinars.knowledgewave.com/xml/1033499.xml', 'r' );


  while( $data = fread( $f, 4096 ) )
  {
  xml_parse( $parser, $data );
  }

  xml_parser_free( $parser );

//start table code
  foreach( $g_books as $book )
  {
   if ($book['CLASS_DATE'] == 'ON DEMAND')
   {

    $bb = $book['LONGDESCRIPTION'];
        $b = html_entity_decode($bb);

        echo "<tr><td>";
        echo "<table border=0>";
        echo"<tr><td><a id='".$book['PRODUCTID']."link' href='javascript:showDetails(".$book['PRODUCTID'].")'>".$book['PRODUCTNAME']."</a></td></tr>";
        echo "<tr><td id='".$book['PRODUCTID']."' style='font-size: 18px; height: 20px; display: block;'>".$bb."dd</td></tr>";
        echo "</table></td>";
        echo"<td>N/A</td>";
        echo"<td><a href='http://members.logontolearn.com/amember/signup.php'>WATCH NOW</a></td>";
        echo"</tr>";
    }
  }
//end table code;


echo "<tr><td>";
echo "<table border=0>";
echo "<tr><td><a id=\"$book[PRODUCTID].link\" href='javascript:showDetails(\"$book[PRODUCTID]\")'>$book[PRODUCTNAME]</a></td></tr>";
echo "<tr><td id=\"$book[PRODUCTID]\" style=\"font-size: 18px; height: 20px; display: block;\">".$bb."dd</td></tr>";
echo "</table></td>";
echo "<td>N/A</td>";
echo "<td><a href=\"http://members.logontolearn.com/amember/signup.php\">WATCH NOW</a></td>";
echo "</tr>";

Try that


Since this actually outputs the tags as expected, I can only guess that the problem is somewhere in the overall HTML of your site - if you can provide the URL, we can probably figure out why it's not showing. If not, I recommend running your HTML output through something like validator.w3.org. Also, PHP4 has been officially deprecated for some time now - try looking over the list of providers at GoPHP5.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜