Jump to content

Problems with php header


ninedoors

Recommended Posts

I am trying to convert my html header to a php header.  The header I currently use uses javascript to do image swaps for my buttons.  When I tried to use echos to display my header everything is fine except the javascript isn't working.  It is all in a function so it can be used over easily.  I have put the javascript functions in a separate .js file and just made a call to it.  Can anyone tell me if they see anything wrong in my code.  I will attach a jpeg of my header with the code below for it.  If you are wondering I am using this to try and integrate my header of my website into my forum. 

 

Basically, I am wondering if there any tricks to calling javascript function in php?     

 

<?php
// The main sub template above the content.
function template_main_above()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;

// Show right to left and the character set for ease of translating.
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Barrie Men\'s Hockey League Forum</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/script.js"></script>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
	var smf_theme_url = "', $settings['theme_url'], '";
	var smf_images_url = "', $settings['images_url'], '";
	var smf_scripturl = "', $scripturl, '";
	var smf_iso_case_folding = ', $context['server']['iso_case_folding'] ? 'true' : 'false', ';
	var smf_charset = "', $context['character_set'], '";
// ]]></script>';

// The ?fin11 part of this link is just here to make sure browsers don't cache it wrongly.
echo '
<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/style.css?fin11" />
<link rel="stylesheet" type="text/css" href="', $settings['default_theme_url'], '/print.css?fin11" media="print" />';

/* Internet Explorer 4/5 and Opera 6 just don't do font sizes properly. (they are big...)
	Thus, in Internet Explorer 4, 5, and Opera 6 this will show fonts one size smaller than usual.
	Note that this is affected by whether IE 6 is in standards compliance mode.. if not, it will also be big.
	Standards compliance mode happens when you use xhtml... */
if ($context['browser']['needs_size_fix'])
	echo '
<link rel="stylesheet" type="text/css" href="', $settings['default_theme_url'], '/fonts-compat.css" />';

echo '
</head>
<body onLoad="MM_preloadImages(' , $settings['images_url'] , '/menuforum2/images/menu_r3_c4_f2.gif\',' , $settings['images_url'] , '/menuforum2/images/menu_r3_c5_f2.gif\',' , $settings['images_url'] , '/menuforum2/images/menu_r3_c6_f2.gif\',' , $settings['images_url'] , '/menuforum2/images/menu_r3_c7_f2.gif\',' , $settings['images_url'] , '/menuforum2/images/menu_r3_c8_f2.gif\',' , $settings['images_url'] , '/menuforum2/images/menu_r3_c9_f2.gif\',' , $settings['images_url'] , '/menuforum2/images/menu_r3_c10_f2.gif\',' , $settings['images_url'] , '/menuforum2/images/menu_r3_c11_f2.gif\')">
<table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center"><table border="0" cellpadding="0" cellspacing="0" width="780">
      <tr>';

echo '
 	<td><img src="' , $settings['images_url'] , '/menuforum2/images/spacer.gif" alt="" name="undefined_2" width="209" height="1" border="0"></td>
        <td><img src="' , $settings['images_url'] , '/menuforum2/images/spacer.gif" alt="" name="undefined_2" width="25" height="1" border="0"></td>
        <td><img src="' , $settings['images_url'] , '/menuforum2/images/spacer.gif" alt="" name="undefined_2" width="30" height="1" border="0"></td>
        <td><img src="' , $settings['images_url'] , '/menuforum2/images/spacer.gif" alt="" name="undefined_2" width="63" height="1" border="0"></td>
        <td><img src="' , $settings['images_url'] , '/menuforum2/images/spacer.gif" alt="" name="undefined_2" width="53" height="1" border="0"></td>
        <td><img src="' , $settings['images_url'] , '/menuforum2/images/spacer.gif" alt="" name="undefined_2" width="73" height="1" border="0"></td>
        <td><img src="' , $settings['images_url'] , '/menuforum2/images/spacer.gif" alt="" name="undefined_2" width="73" height="1" border="0"></td>
        <td><img src="' , $settings['images_url'] , '/menuforum2/images/spacer.gif" alt="" name="undefined_2" width="53" height="1" border="0"></td>
        <td><img src="' , $settings['images_url'] , '/menuforum2/images/spacer.gif" alt="" name="undefined_2" width="58" height="1" border="0"></td>
        <td><img src="' , $settings['images_url'] , '/menuforum2/images/spacer.gif" alt="" name="undefined_2" width="68" height="1" border="0"></td>
        <td><img src="' , $settings['images_url'] , '/menuforum2/images/spacer.gif" alt="" name="undefined_2" width="68" height="1" border="0"></td>
        <td><img src="' , $settings['images_url'] , '/menuforum2/images/spacer.gif" alt="" name="undefined_2" width="7" height="1" border="0"></td>
        <td><img src="' , $settings['images_url'] , '/menuforum2/images/spacer.gif" alt="" name="undefined_2" width="1" height="1" border="0"></td>
      </tr>';

echo '
	<tr>
        <td rowspan="2" colspan="2"><img name="menu_r1_c1_2" src="' , $settings['images_url'] , '/menuforum2/images/menu_r1_c1.gif" width="234" height="146" border="0" alt=""></td>
        <td colspan="10"><table width="546" height="50" border="0" cellpadding="0" cellspacing="2">
          <tr>
            <td colspan="2"> </td>
          </tr>';
$date = date('F jS, Y  g:i a');
echo '
		<tr>
            <td width="529" align="right" valign="top" class="geor11"></td>
            <td width="11" align="right" valign="top"> </td>
          </tr>
        </table></td>';

echo '
	<td><img src="' , $settings['images_url'] , '/menuforum2/images/spacer.gif" alt="" name="undefined_2" width="1" height="50" border="0"></td>
      </tr>
      <tr>
        <td colspan="10"><img name="menu_r2_c3_2" src="' , $settings['images_url'] , '/menuforum2/images/menu_r2_c3.gif" width="546" height="96" border="0" alt=""></td>
        <td><img src="' , $settings['images_url'] , '/menuforum2/images/spacer.gif" alt="" name="undefined_2" width="1" height="96" border="0"></td>
      </tr>';

//this is where the image swapping happens and I can't get the buttons to work properly.
echo '<tr>
	 <td rowspan="3"><img name="menu_r3_c1_2" src="' , $settings['images_url'] , '/menuforum2/images/menu_r3_c1.gif" width="209" height="84" border="0" alt=""></td>
        <td rowspan="3" colspan="2"><img name="menu_r3_c2_2" src="' , $settings['images_url'] , '/menuforum2/images/menu_r3_c2.gif" width="55" height="84" border="0" alt=""></td>';

echo '<td><a href="/index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\"menu_r3_c4_2\",\"\",\"' , $settings['images_url'] , '/menuforum2/images/menu_r3_c4_f2.gif\",1);"><img name="menu_r3_c4_2" src="' , $settings['images_url'] , '/menuforum2/images/menu_r3_c4.gif" width="63" height="25" border="0" alt=""></a></td>
        <td><a href="/info/info.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'menu_r3_c5_2\',\'\',\'' , $settings['images_url'] , '\'/menuforum2/images/menu_r3_c5_f2.gif\',1);"><img name="menu_r3_c5_2" src="' , $settings['images_url'] , '/menuforum2/images/menu_r3_c5.gif" width="53" height="25" border="0" alt=""></a></td>
        <td><a href="/schedule/schedule.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'menu_r3_c6_2\',\'\',' , $settings['images_url'] , '/menuforum2/images/menu_r3_c6_f2.gif\',1);"><img name="menu_r3_c6_2" src="' , $settings['images_url'] , '/menuforum2/images/menu_r3_c6.gif" width="73" height="25" border="0" alt=""></a></td>
        <td><a href="/standing/standings.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'menu_r3_c7_2\',\'\',' , $settings['images_url'] , '/menuforum2/images/menu_r3_c7_f2.gif\',1);"><img name="menu_r3_c7_2" src="' , $settings['images_url'] , '/menuforum2/images/menu_r3_c7.gif" width="73" height="25" border="0" alt=""></a></td>
        <td><a href="/stats/stats.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'menu_r3_c8_2\',\'\',' , $settings['images_url'] , '/menuforum2/images/menu_r3_c8_f2.gif\',1);"><img name="menu_r3_c8_2" src="' , $settings['images_url'] , '/menuforum2/images/menu_r3_c8.gif" width="53" height="25" border="0" alt=""></a></td>
        <td><a href="/forum/" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'menu_r3_c9_2\',\'\',' , $settings['images_url'] , '/menuforum2/images/menu_r3_c9_f2.gif\',1);"><img name="menu_r3_c9_2" src="' , $settings['images_url'] , '/menuforum2/images/menu_r3_c9.gif" width="58" height="25" border="0" alt=""></a></td>
        <td><a href="/sponsors/sponsors.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'menu_r3_c10_2\',\'\',' , $settings['images_url'] , '/menuforum2/images/menu_r3_c10_f2.gif\',1);"><img name="menu_r3_c10_2" src="' , $settings['images_url'] , '/menuforum2/images/menu_r3_c10.gif" width="68" height="25" border="0" alt=""></a></td>
        <td><a href="/contact/contact.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'menu_r3_c11_2\',\'\',' , $settings['images_url'] , '/menuforum2/images/menu_r3_c11_f2.gif\',1);"><img name="menu_r3_c11_2" src="' , $settings['images_url'] , '/menuforum2/images/menu_r3_c11.gif" width="68" height="25" border="0" alt=""></a></td>
        <td rowspan="3"><img name="menu_r3_c12_2" src="' , $settings['images_url'] , '/menuforum2/images/menu_r3_c12.gif" width="7" height="84" border="0" alt=""></td>
        <td><img src="' , $settings['images_url'] , '/menuforum2/images/spacer.gif" alt="" name="undefined_2" width="1" height="25" border="0"></td>
      </tr>';

echo '
	<tr>
        <td colspan="8"><img name="menu_r4_c4_2" src="' , $settings['images_url'] , '/menuforum2/images/menu_r4_c4.gif" width="509" height="9" border="0" alt=""></td>
        <td><img src="' , $settings['images_url'] , '/menuforum2/images/spacer.gif" alt="" name="undefined_2" width="1" height="9" border="0"></td>
      </tr>
      <tr>
        <td colspan="8"><table width="509" height="50" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td bgcolor="#194285" class="search" align="right">
		<form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '" style="margin: 0;">
					<a href="', $scripturl, '?action=search;advanced"><img src="'.$settings['images_url'].'/filter.gif" align="middle" style="margin: 0 1ex;" alt="" /></a>
					<input type="text" name="search" value="" style="width: 190px;" /> 
					<input type="submit" name="submit" value="', $txt[182], '" style="width: 11ex;" />
					<input type="hidden" name="advanced" value="0" /></td></form>
          </tr>
        </table></td>
        <td><img src="' , $settings['images_url'] , '/menuforum2/images/spacer.gif" alt="" name="undefined_2" width="1" height="50" border="0"></td>
      </tr>
    </table>    </td>
  </tr>
  <tr>
    <td width="766" align="left" valign="top">';

ssi_menubar();

echo '</td>
    <td width="18"> </td>
  </tr>
  <tr><td> </td></tr>
</table>';

}
?>

 

If you need any more info just ask, I will be checking this thread frequently.

 

Nick

 

[attachment deleted by admin]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.