I am trying to reference a JavaScript file, containing a table sort function, in a PHP file.
Everything functions the way it should, but once I add the code below to my PHP report page it causes issues with the format of the tabs on my navigation page. The same issue comes up if I add a random document.write
outside of the PHP code. Not a huge issue but rather unsightly to the user.
Is there a better way to reference the JavaScript source doc that will not interfer with my php navigation page format? I feel like there is a simple fix that I am not grasping.
<script language="JavaScript" src="include/sorttable.js"></script>
Also used an the PHP echo
inside the PHP tags to make the call, same issue.
Here is part of the navigation code for the tabs that the format issue is coming up on.
<?php
//////////////////////////////////////////////////////////////////////////////////////////////////
function start_page_printer_friendly(
$section = "home",
$headContents = null,
$bodyAttributes = null
)
//////////////////////////////////////////////////////////////////////////////////////////////////
{?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title><?php print $page_title; ?></title>
<link href="/trellis_portal/include/portal.css" media="screen"
rel="Stylesheet" type="text/css" />
<?php if ( ! is_null($headContents)) { print $headContents; } ?>
</head>
<body onload="printpage();" <?php if ( ! is_null($bodyAttributes)) { print $bodyAttributes; } ?>>
<script language="JavaScript">
<!--
function printpage() { window.print(); }
-->
</script>
<br />
<?php
}
//////////////////////////////////////////////////////////////////////////////////////////////////
function start_page( $section = "home",
$subsection = null,
$headContents = null,
$bodyAttributes = null
)
//////////////////////////////////////////////////////////////////////////////////////////////////
{
if (isset($_GET['printer']))
{
start_page_printer_friendly();
return;
}
$section = strtolower($section);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title><?php print $page_title; ?></title>
<?php if ( ! is_null($headContents)) { print $headContents; } ?>
</head>
<body class=" yui-skin-sam" <?php if ( ! is_null($bodyAttributes)) { print $bodyAttributes; } ?>>
<br />
<div id="header">
<ul>
<!--
<li><a class="<?php print tabSelector($section, 'executive'); ?>"
href="/trellis_portal/portal.php?section=executive&title=Executive">Executive</a></li>
<li><a
class="<?php print tabSelector($section, 'community'); ?>"
href="/trellis_portal/portal.php?section=community&title=Community">Community</a></li>
-->
<li><a class="<?php print tabSelector($section, 'trellis'); ?>"
href="/trellis_portal/portal.php?section=trellis&title=Trellis">Trellis</a></li>
<!--