anchors tags cannot be clicked on XML and JSON output pages



Probably an easy fix but it's had me for the last few hours.


Basically, on my site I have a navigation bar. These are included in 'nav.php'. I am outputting JSON and XML on two separate pages. On these pages the navigation bar cannot be clicked. Its as if the whole page freezes up. It works fine on the rest of the site.


JSON Page



<?php
require_once __DIR__ . ('/../config/init.php');

$mysqli = new mysqli($db['hostname'], $db['username'], $db['password'], $db['database']);
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}

$sql = "SELECT * FROM news WHERE live = '1'";
$result = mysqli_query($mysqli,$sql);
$json = array();


while($row=mysqli_fetch_row($result)){
$json['news'][]=$row;
}
?>

<!DOCTYPE html>
<html>
<head>
<?php
include INCLUDES . 'head_tags.php';
?>
</head>
<body>
<div class='container'>
<?php
include INCLUDES . 'header.php';
include INCLUDES . 'nav.php';
?>
<div class='two-thirds column'>
<div class='json'>
<?php
echo json_encode($json);
?>
</div>
</div>


<?php
include INCLUDES . 'footer.php';
?>
</div>
</body>
</html>


XML Page



<?php

$xml = new DOMDocument;
$xml->load('http:/mysite.co.uk/index_xml.php');

$xsl = new DOMDocument;
$xsl -> load('style.xsl');

$proc = new XSLTProcessor;

$proc -> importStyleSheet($xsl);



?>

<?php
//Require config file outside of head tags so functions and classes can be used before html is loaded
require_once __DIR__ . ('/config/init.php');
?>
<!DOCTYPE html>
<html>
<head>
<?php
//Only has tags that go instead the <head> tag
include INCLUDES . 'head_tags.php';
?>
</head>
<body>
<div class='container'>
<?php
include INCLUDES . 'header.php';
include INCLUDES . 'nav.php';
?>
<div class='two-thirds column'>
<?php
echo $proc -> transformToXML($xml);
?>
</div>


<?php
include INCLUDES . 'footer.php';
?>
</div>
</body>
</html>


Cheers!


No comments:

Post a Comment