Link to home
Start Free TrialLog in
Avatar of EmeraldIsleNC
EmeraldIsleNCFlag for United States of America

asked on

Using Cookies with a Dreamweaver Spry Collapsible Panel - Auto opens only once per visit?

Hello. I'm brand new to Experts Exchange. I've seen one question on here related to using cookies with a Spry Collapsible Panel, and I've tried that particular solution, but it's not quite what I'm looking for. Hopefully I can get a solution to the specific problem I'm trying to figure out:

What I want to do is use a Spry Collapsible Panel to be open when someone initially visits the homepage of the site, but as they navigate around the site, and then come back to the homepage for whatever reason, I don't want the collapsible panel to be open automatically on subsequent visits to the home page-- at least not in the same browser session.

So... very simply, here's what I want to happen:

User first arrives at homepage --> Collapsible Window is open by default until they close it.

User navigates to other pages -->I'm using a different template so collapsible window is set to be closed by default on those pages

User hits the "Home" button to navigate back to home page from elsewhere in site during same visit --> Collapsible window is closed by default in this subsequent visit.

If they close their browser and later in the day open their browser to go back to the site again, it doesn't matter to me if they don't get the collapsible window open on their initial visit or not. I'd probably prefer that the collapsible window is only open by default ONCE per day, but ONCE per session would work, too.

Here's the page of the site I'm working on: http://www.bonesvillemedia.com/pirateclub-v3/ 

Any ideas?

Thanks in advance!

Sara
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Hi Sara,

Because the default state of the panel is set by a little javascript code at the end of the document, it should be possible to use a cookie to determine the initial state.  Check to see if the cookie exists, if so, then the user must have seen the page before, so set the cookie to close the panel.  If the cookie does not exist, set it to open the panel.

At the bottom of the page, use the value of the cookie to determine which javascript line prints.

Pseduocode for PHP:
<?php
if (isset($_COOKIE['opensesame'])) {
    $_COOKIE['opensesame'] = 'closed';
} else {
  setcookie("opensesame", "open", time()+X); // where X is the number of seconds until the cookie expires
}
?>
<html>
<body>
.
.
.
.
<?php if ($_COOKIE['opensesame'] == 'open') { ?>
<script type="text/javascript">
	var CollapsiblePanel1 = new Spry.Widget.CollapsiblePanel("CollapsiblePanel1", { contentIsOpen: true });
</script>
<? } else { ?>
<script type="text/javascript">
	var CollapsiblePanel1 = new Spry.Widget.CollapsiblePanel("CollapsiblePanel1", { contentIsOpen: false });
</script>
<?php } ?>
</body>
</html>

Open in new window

Avatar of EmeraldIsleNC

ASKER

Ok this looks like it makes sense and I look forward to trying it out.

Forgive me for asking a question that will surely show how ignorant I am (LOL), but I'm a designer and not great with coding...

This is php and since my page is html with some javascripting, would this work as is in php or would I need to convert it to javascript somehow?

And how would I go about doing that?

If it will work as is, I'm assuming you mean I can copy the top snippet of the code into the HEAD section of the page and the second snippet I would copy into the bottom of the page down near where the Spry widget code calling on the Collapsible Panel javascript file is located?

Thanks again!

Sara
<HEAD>
.
.
.
<!-- This is the code that calls on the js file and creates the Spry Collapsible Panel -->
 
<script src="../SpryAssets/SpryCollapsiblePanel.js" type="text/javascript"></script>
.
.
.
</HEAD>
<BODY>
.
.
.
<!-- The portion below is created based on whether you set the panel to be OPEN on load or CLOSED on load -->
 
<script type="text/javascript">
<!--
var CollapsiblePanel1 = new Spry.Widget.CollapsiblePanel("HomePageAnnouncement", {contentIsOpen:false});
var MenuBar2 = new Spry.Widget.MenuBar("MenuBar2", {imgRight:"/pirateclub-v3/SpryAssets/SpryMenuBarRightHover.gif"});
//-->
</script>
</BODY>

Open in new window

>> This is php and since my page is html with some javascripting, would this work as is in php or would I need to
>> convert it to javascript somehow?

It would be pretty close to working as is in PHP.  You could probably do something similiar in javascript, but js is not my strong suit and I'm a little fuzzy on using it to control cookies.  So I play to my strength...

>> I can copy the top snippet of the code into the HEAD section of the page

No, the top part goes above the <html> tag, before any other code.  I included the tags in my sample to show you where things should go.

>> second snippet I would copy into the bottom of the page

Yes, except that you want to use the <?php ?> code to wrap around your <script> tags.  My code is a conditional that checks to see what the value of the cookie is and echoes the correct javascript to open or close the panel.
Ok... so I tested this on a test page WITHOUT a template applied and it seemed to work ok.

Unfortunately, when I try to apply this code to either my index.html page or the template that's attached to my index.html page (I've tried it both ways), I get an abundance of errors.

One error claims that "This document contains JavaScript code for a widget that doesn't exist." (See attached file for screen shot of error.)

If I click on "Yes" When that error comes up, it simply gives me a long list of instances of that particular widget being called, but I have no idea what to do with that information.

I'm wondering if I should be identifying the widget by the name it's assigned in DreamWeaver which is "HomepageAnnouncement?"

There are other errors that come up, too, but I think they all may be related to this one.
widget-doesn-t-exist.jpg
widget-instances.jpg
Actually... I'm wondering if the code should be in the template or if it should be in the index.html file itself?

that widget error is to be expected. DW won't like the fact that the javascript call is now contained inside of PHP and you will get "errors"

But the code will work via the browser and that's the important thing...
Ok... I've tried including this in the template itself, but it ends up causing IE to crash virtually every time I test the page, and depending on certain variables, it will open the page, but give me errors.

I'm trying to use it directly in the code for index.html and it's still not working. I'm getting the error attached.

See the code for the page below. (I'm leaving in all of the code for index.html as it's given under "View Source" from the browser, because honestly, line 316 doesn't even appear to have anything to do with any of this scripting stuff.)

Thanks!
<?php
if (isset($_COOKIE['opensesame'])) {
    $_COOKIE['opensesame'] = 'closed';
} else {
  setcookie("opensesame", "open", time()+X); // where X is the number of seconds until the cookie expires
}
?>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/homepage.dwt" codeOutsideHTMLIsLocked="true" -->
 
<head>
 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>East Carolina University Pirate Club</title>
<!-- InstanceEndEditable -->
<style type="text/css">
<!--
body {
	background-color: #5c3896;
	margin-top: 10px;
	margin-left: 10px;
	margin-right: 10px;
	margin-bottom: 10px;
}
a:link {
	color: #5C3896;
}
a:visited {
	color: #5C3896;
}
a:hover {
	color: #ffdf1c;
}
a:active {
	color: #9966FF;
}
.style1 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: x-small;
	color: #FFFFFF;
}
.style3 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: small;
	color: #000;
}
.style4 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: medium;
	font-weight: bold;
}
.style5 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: small;
}
.style6 {font-family: Arial, Helvetica, sans-serif; font-size: small; font-weight: bold; }
-->
</style>
<script src="scripts/AC_RunActiveContent.js" type="text/javascript"></script>
 
<script src="SpryAssets/SpryCollapsiblePanel.js" type="text/javascript"></script>
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<script language="javascript">
/*
Auto center window script- Eric King (http://redrival.com/eak/index.shtml)
Permission granted to Dynamic Drive to feature script in archive
For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/
 
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}
 
</script>
 
<script type="text/javascript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
<!-- InstanceBeginEditable name="head" -->
 
 
<style type="text/css">
<!--
.style1 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
}
 
.style9 {
	font-size: 14px;
	color: #000000;
}
body {
	margin-left: 0px;
	margin-top: 10px;
	margin-right: 0px;
	margin-bottom: 10px;
}
.style12 {font-family: Arial, Helvetica, sans-serif; color: #000000; }
.style13 {font-size: small}
.style14 {
	color: #000000;
	font-size: small;
}
-->
</style>
<style type="text/css">
<!--
.style16 {	font-family: Arial, Helvetica, sans-serif;
	font-size: x-small;
	color: #FFFFFF;
}
.style16 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: bold;
}
-->
</style>
<style type="text/css">
<!--
.style17 {
	font-size: large;
	font-weight: bold;
	font-family: Arial, Helvetica, sans-serif;
}
-->
</style>
<style type="text/css">
<!--
.style18 {	font-family: Arial, Helvetica, sans-serif;
	font-size: x-small;
	color: #FFFFFF;
}
.style18 {	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
}
-->
</style>
<style type="text/css">
<!--
.style21 {	font-family: Arial, Helvetica, sans-serif;
	font-size: x-small;
	color: #FFFFFF;
}
.style21 {	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
}
-->
</style>
<style type="text/css">
<!--
.style22 {color: #FFFFFF}
-->
</style>
<!-- InstanceEndEditable --><!-- InstanceParam name="src" type="URL" value="about/images/history.jpg" -->
<style type="text/css">
<!--
-->
</style>
 
 
<link href="SpryAssets/SpryCollapsiblePanel.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
-->
</style>
</head>
 
<body>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr valign="top" bgcolor="#FFFFFF">
    <td colspan="3"><div id="HomePageAnnouncement" class="CollapsiblePanel">
      <div class="CollapsiblePanelTab" tabindex="0">
        <div align="center">SPECIAL BULLETIN! (CLICK HERE TO OPEN/CLOSE THIS PANEL)</div>
      </div>
      <div class="CollapsiblePanelContent">
        <p align="center"><a href="https://pirates.maxwell3.com/default.aspx" target="_blank"><img src="images/PirateClubStore.jpg" alt="Visit the Pirate Club Store" width="489" height="55" border="0" /></a></p>
        <p align="center"><a href="https://pirates.maxwell3.com/default.aspx" target="_blank"><img src="images/piratestore.gif" alt="Pirate Club Store" width="700" height="345" border="0" /></a></p>
      </div>
    </div></td>
  </tr>
  <tr valign="middle" bgcolor="#FFDF1C">
    <td bgcolor="#5C3896"><div align="center"><a href="index.html"><img src="images/logo-pic.jpg" alt="East Carolina University Pirate Club - Click here to go to the home page." width="135" height="166" border="0" /></a></div></td>
    <td bgcolor="#5C3896"><table border="0" align="center" cellpadding="0" cellspacing="0">
      <tr valign="top">
        <td align="center"><table border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td colspan="2"><div align="center"><img src="images/jointheteambehindtheteams400px.jpg" alt="Join the team behind the teams!" width="400" height="75" /></div>
                <div align="right"></div></td>
            </tr>
            <tr>
              <td colspan="2"><script type="text/javascript">
 
/***********************************************
* IFRAME Scroller script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
 
//specify path to your external page:
var iframesrc="http://www.bonesvillemedia.com/pirateclub-v3/external.htm"
 
//You may change most attributes of iframe tag below, such as width and height:
document.write('<iframe id="datamain" src="'+iframesrc+'" width="400px" height="80px" marginwidth="0" marginheight="5" frameborder="0" scrolling="no"></iframe>')
 
    </script></td>
            </tr>
        </table></td>
        </tr>
    </table></td>
    <td width="205" bgcolor="#5C3896"><div align="center"><img src="images/200x155 spaceholder.jpg" width="200" height="155" /></div></td>
  </tr>
  <tr valign="top">
    <td colspan="3" bgcolor="#FFFFFF"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="145" valign="top" bgcolor="#FFF14F"><ul id="MenuBar2" class="MenuBarVertical">
          <li><a href="index.html">Home</a></li>
          <li><a class="MenuBarItemSubmenu" href="#">About the Pirate Club</a>
              <ul>
                <li><a href="about/index.html">General Information</a></li>
                <li><a href="about/mission.html">Our Mission</a></li>
                <li><a href="about/history.html">Our History</a></li>
                <li><a href="about/staff/index.html">Our Staff</a></li>
                <li><a href="about/waystogive.html">Ways to Give</a></li>
              </ul>
          </li>
          <li><a href="#" class="MenuBarItemSubmenu">Pirate Club Chapters</a>
          <ul>
            <li><a href="chapters/index.html">Chapter Information</a></li>
            <li><a href="chapters/chapter_contacts.html">Chapter Contacts</a></li>
            <li><a href="chapters/chapter_map.html">Chapter Map</a></li>
            <li><a href="chapters/letterwinners_chapter.html">The Letterwinners' Chapter</a></li>
          </ul>
      </li>
      <li><a class="MenuBarItemSubmenu" href="#">Pirate Club Membership</a>
          <ul>
            <li><a href="membership/index.html">Membership Levels</a> </li>
            <li><a href="membership/pirateclub.html">Pirate Club (Traditional)</a></li>
            <li><a href="membership/junior_pc.html">Junior Pirate Club</a></li>
            <li><a href="membership/kids_club.html">Chick-fil-A Pirate Kids Club</a></li>
            <li><a href="membership/student_pc.html">Student Pirate Club</a></li>
            <li><a href="membership/younggrad.html">Young Graduate Pirate Club</a></li>
          </ul>
      </li>
      <li><a href="#">Pirates Supporting Pirates</a></li>
      <li><a href="#">Pirate Club News</a></li>
      <li><a href="https://pirates.maxwell3.com/" target="_blank">Pirate Club Store</a></li>
      <li><a href="#">Donate Online</a></li>
      <li><a href="#">Calendar</a></li>
      <li><a href="#">Contact Us</a></li>
        </ul>        
          <p align="center"><a href="popups/2008parking.html" onclick="NewWindow(this.href,'name','300','220','no');return false"><img src="images/left-column-ads/2008-parking-dkprple.jpg" alt="2008 Football Parking" width="147" height="269" border="0" /><br />
          </a><img src="images/PiratesChest/April2008PC.jpg" alt="April 2008 Pirates' Chest" width="147" height="188" /><br />  
            <span class="style6">Get a sneak peek at<br />
            the June/July issue of<br />
            <em>The Pirates' Chest</em>...<br />
  Subscribe today!</span></p>          
          <p align="center" class="style6"><a href="pdf/pc_banner_brochure.pdf" target="_blank"><img src="images/left-column-ads/DrapeGreenvilleInPurpleandGold.jpg" alt="Drape Greenville in Purple &amp; Gold" width="147" height="60" border="0" /></a><br />
            <span class="style6">Display the all-new<br />
Pirate Club Banner<br />
at your business</span></p>
          </td>
        <td valign="top"><!-- InstanceBeginEditable name="MainText" -->
          <table width="100%" border="0" cellpadding="5" cellspacing="0">
  <tr>
    <td valign="top"><p><img src="images/teambehindteams.jpg" alt="The Team Behind the Teams" width="154" height="93" align="left" /><img src="images/the-call.jpg" alt="Answer the Call" width="125" height="286" hspace="5" align="right" /> </p>
      <div align="left" class="style12">
        <p align="left">&nbsp;</p>
        <p align="left">&nbsp;</p>
        <p align="left"><br />
          <span class="style13"><strong><br />
                      The East Carolina University Educational Foundation, Inc., </strong>better   known as the Pirate Club, is the backbone of financial support   for ECU Athletics.<br />
                  <br />
          Funds raised by the Pirate Club from alumni, fans and   friends, go to help fund scholarships for Pirate student-athletes, athletic   facility improvements and other programmatic needs for the university's Division   I athletic program.<br />
          <br />
          If you are interested in ECU Pirate Club membership,   know someone who may be interested, or have not renewed your membership, please <a href="contact.html">contact</a> the Pirate Club at (252)   737-4540 or <a href="http://ev8.evenue.net/cgi-bin/ncommerce3/ExecMacro/evenue/ev67/se/Main.d2w/report?linkID=ecu">make   a pledge</a> online and join &quot;the team behind the teams.&quot;<br />
          <br />
          <strong>Special   Memberships for Everyone</strong><br />
          <a href="membership/kids_club.html">Chick-fil-A Kids   Club<br />
            </a><a href="membership/student_pc.html">Student Pirate Club</a><br />
            <a href="membership/younggrad.html">Young Graduate Pirate Club</a><br />
            <a href="chapters/letterwinners_chapter.html">Letterwinners' Chapter</a><a href="juniorpc.html"><br />
              </a><a href="membership/pirateclub.html">Adult Pirate   Club</a><br />
              <br />
              <strong>Answer the Call</strong><br />
              <a href="pdf/PC%20Application2008revised.pdf">Download the 2008 Pirate Club   Application</a><br />
              <a href="http://ev12.evenue.net/cgi-bin/ncommerce3/DPLanding?linkID=ecu&amp;RSRC=&amp;RDAT=&amp;url=https%3A//ev12.evenue.net/cgi-bin/ncommerce3/DPLanding%3FlinkID%3Decu%26RSRC%3D%26RDAT%3D%26url%3Dhttps%253A//ev12.evenue.net/cgi-bin/ncommerce3/ExecMacro/evenue/ev69/se/Main.d2w/report%253FlinkID%253Decu" target="_blank">Join with a secure online pledge</a><br />
              <a href="/contact.html">Contact the Pirate Club</a><br />
              <br />
              <strong>Ticket Priority   Deadline<br />
                  </strong>Don't forget, May 1 is the deadline for ticket priority for   2008 football. Order your tickets early!</span></p>
        <p align="center"><img src="images/200px_gold_bar.jpg" width="250" height="5" /></p>
        <p align="center" class="style3"><img src="images/chamionscollection-text.jpg" alt="The Champions Collection" width="300" height="47" /></p>
        <p align="center" class="style3"><img src="images/champions-collection.jpg" alt="Champions Collection" width="200" height="254" /></p>
        <p class="style3">2008 marks the 14th edition of the <strong>Champions Collection</strong>.   This years edition features another poem created by ECU alum Al Lockamy based   upon a quote by Leo Jenkins  Above all, I take with me the lasting commitment   to <strong>answer the call</strong> of East Carolina,   whenever and where I can serve.</p>
        <p class="style3">The Pirate Nation are the greatest fans in college athletics, and they must   respond with 110% effort again in 2008.  Pirate fans are always   Champions.</p>
        <span class="style3">Now is your chance to give <strong>110%</strong>, help the Pirate Club   achieve our 2008 goals, and receive your full-color lithograph. (<a href="pdf/CHAMPIONS 2008.pdf" target="_blank">more</a>)</span>
        <p align="left">&nbsp;</p>
      </div></td>
    <td width="262" valign="top" bgcolor="#000000"><table width="215" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td align="center"><span class="style21">
          <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','205','height','155','align','middle','title','PirateClubVideoGreeting','src','video/video','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','video/video' ); //end AC code
            </script>
          <noscript>
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="205" height="155" align="middle" title="PirateClubVideoGreeting">
            <param name="movie" value="video/video.swf" />
            <param name="quality" value="high" />
            <embed src="video/video.swf" width="205" height="155" align="middle" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash"></embed>
          </object>
          </noscript>
        </span></td>
      </tr>
    </table>      
      <p align="center" class="style9 style17"><img src="images/PiratesChest/June-July-200wide.jpg" alt="Get a Sneak Peek at the June/July Pirates' Chest!" width="250" height="324" /><br />
        <img src="images/sneakpeek.jpg" alt="Get a Sneak Peek at This Month's Pirates' Chest " width="250" height="101" /></p>      <table border="0" align="center" cellpadding="5" cellspacing="5">
        <tr>
          <td bgcolor="#FFFFFF" class="style22"><p align="center" class="style9 style17">Pirate Club Announces<br />
            New Travel Partner</p>
              <p align="center" class="style16"><a href="travel/AAA.html"><img src="images/LOGO_AAA.jpg" alt="AAA is ECU Pirate Club's New Travel Partner" width="150" height="90" border="0" align="top" /></a></p>
              <p align="left"><span class="style18"><span class="style14">The ECU Educational Foundation (Pirate Club) and AAA Vacations   have entered into a three-year agreement through December, 2010 that identifies   the award-winning organization as the official travel provider for all Pira</span></span><span class="style5">te   Club travel. </span></p>
              <p align="justify" class="style18"><a href="travel/AAA.html">Click here for more information.</a></p></td>
          </tr>
      </table></td>
    </tr>
</table>
<!-- InstanceEndEditable --></td>
      </tr>
      
    </table></td>
  </tr>
</table>
<table width="100%" border="0" cellpadding="5">
  <tr>
    <td><div align="center"><span class="style1">©2008 East Carolina University Pirate Club. Site created and maintained by Bonesville Media.</span></div></td>
  </tr>
</table>
 
 
<script type="text/javascript">
<!--
var CollapsiblePanel1 = new Spry.Widget.CollapsiblePanel("HomePageAnnouncement");
var MenuBar2 = new Spry.Widget.MenuBar("MenuBar2", {imgRight:"/pirateclub-v3/SpryAssets/SpryMenuBarRightHover.gif"});
//-->
</script>
</body>
<!-- InstanceEnd -->
<?php if ($_COOKIE['opensesame'] == 'open') { ?>
<script type="text/javascript">
	var CollapsiblePanel1 = new Spry.Widget.CollapsiblePanel("CollapsiblePanel1", { contentIsOpen: true });
</script>
<? } else { ?>
<script type="text/javascript">
	var CollapsiblePanel1 = new Spry.Widget.CollapsiblePanel("CollapsiblePanel1", { contentIsOpen: false });
</script>
<?php } ?>
</html>

Open in new window

error.jpg
Sara, the code I gave you was pseduocode, not a cut and paste solution.  There are things you have to change in the code to make it work properly.  

Line 5:

  setcookie("opensesame", "open", time()+X); // where X is the number of seconds until the cookie expires

See my comment?  You need to replace X with a value in seconds in order to set the expiration date/time of the cookie.

Lines 357-373:

<script type="text/javascript">
<!--
var CollapsiblePanel1 = new Spry.Widget.CollapsiblePanel("HomePageAnnouncement");
var MenuBar2 = new Spry.Widget.MenuBar("MenuBar2", {imgRight:"/pirateclub-v3/SpryAssets/SpryMenuBarRightHover.gif"});
//-->
</script>
</body>
<!-- InstanceEnd -->
<?php if ($_COOKIE['opensesame'] == 'open') { ?>
<script type="text/javascript">
      var CollapsiblePanel1 = new Spry.Widget.CollapsiblePanel("CollapsiblePanel1", { contentIsOpen: true });
</script>
<? } else { ?>
<script type="text/javascript">
      var CollapsiblePanel1 = new Spry.Widget.CollapsiblePanel("CollapsiblePanel1", { contentIsOpen: false });
</script>
<?php } ?>

You just pasted my code without regard to how you named things or other elements in the page.  

Try this, instead:
<script type="text/javascript">
<!--
<?php if ($_COOKIE['opensesame'] == 'open') { ?>
var CollapsiblePanel1 = new Spry.Widget.CollapsiblePanel("HomePageAnnouncement",{ contentIsOpen: true } );
<? } else { ?>
var CollapsiblePanel1 = new Spry.Widget.CollapsiblePanel("HomePageAnnouncement",{ contentIsOpen: false } );
<?php } ?>
var MenuBar2 = new Spry.Widget.MenuBar("MenuBar2", {imgRight:"/pirateclub-v3/SpryAssets/SpryMenuBarRightHover.gif"});
//-->
</script>
</body>
<!-- InstanceEnd -->

Open in new window

I noticed that in that last code snippet it didn't reflect the correct code because in the actual code that was in my browser, it had 28800 which was what I had replaced the value of "x" with (in other words, 8 hours).

Just wanted to point out that that portion was coded with the seconds rather than just "x."
That's fine.  The larger mistake was the one at the end.
LOL Ok... I actually had asked about changing that CollapsiblePanel1 thing to HomePageAnnouncement up in the post with the first error, but I've now applied what you suggested and now I'm getting an IE error with line 358 char 1 and it claims it's a syntax error.

I'm sorry this is turning into such a pain! I can't tell you how much I appreciate your help, though.
<?php
if (isset($_COOKIE['opensesame'])) {
    $_COOKIE['opensesame'] = 'closed';
} else {
  setcookie("opensesame", "open", time()+28800); // where X is the number of seconds until the cookie expires
}
?>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/homepage.dwt" codeOutsideHTMLIsLocked="true" -->
 
<head>
 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>East Carolina University Pirate Club</title>
<!-- InstanceEndEditable -->
<style type="text/css">
<!--
body {
	background-color: #5c3896;
	margin-top: 10px;
	margin-left: 10px;
	margin-right: 10px;
	margin-bottom: 10px;
}
a:link {
	color: #5C3896;
}
a:visited {
	color: #5C3896;
}
a:hover {
	color: #ffdf1c;
}
a:active {
	color: #9966FF;
}
.style1 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: x-small;
	color: #FFFFFF;
}
.style3 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: small;
	color: #000;
}
.style4 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: medium;
	font-weight: bold;
}
.style5 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: small;
}
.style6 {font-family: Arial, Helvetica, sans-serif; font-size: small; font-weight: bold; }
-->
</style>
<script src="scripts/AC_RunActiveContent.js" type="text/javascript"></script>
 
<script src="SpryAssets/SpryCollapsiblePanel.js" type="text/javascript"></script>
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<script language="javascript">
/*
Auto center window script- Eric King (http://redrival.com/eak/index.shtml)
Permission granted to Dynamic Drive to feature script in archive
For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/
 
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}
 
</script>
 
<script type="text/javascript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
<!-- InstanceBeginEditable name="head" -->
 
 
<style type="text/css">
<!--
.style1 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
}
 
.style9 {
	font-size: 14px;
	color: #000000;
}
body {
	margin-left: 0px;
	margin-top: 10px;
	margin-right: 0px;
	margin-bottom: 10px;
}
.style12 {font-family: Arial, Helvetica, sans-serif; color: #000000; }
.style13 {font-size: small}
.style14 {
	color: #000000;
	font-size: small;
}
-->
</style>
<style type="text/css">
<!--
.style16 {	font-family: Arial, Helvetica, sans-serif;
	font-size: x-small;
	color: #FFFFFF;
}
.style16 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: bold;
}
-->
</style>
<style type="text/css">
<!--
.style17 {
	font-size: large;
	font-weight: bold;
	font-family: Arial, Helvetica, sans-serif;
}
-->
</style>
<style type="text/css">
<!--
.style18 {	font-family: Arial, Helvetica, sans-serif;
	font-size: x-small;
	color: #FFFFFF;
}
.style18 {	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
}
-->
</style>
<style type="text/css">
<!--
.style21 {	font-family: Arial, Helvetica, sans-serif;
	font-size: x-small;
	color: #FFFFFF;
}
.style21 {	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
}
-->
</style>
<style type="text/css">
<!--
.style22 {color: #FFFFFF}
-->
</style>
<!-- InstanceEndEditable --><!-- InstanceParam name="src" type="URL" value="about/images/history.jpg" -->
<style type="text/css">
<!--
-->
</style>
 
 
<link href="SpryAssets/SpryCollapsiblePanel.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
-->
</style>
</head>
 
<body>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr valign="top" bgcolor="#FFFFFF">
    <td colspan="3"><div id="HomePageAnnouncement" class="CollapsiblePanel">
      <div class="CollapsiblePanelTab" tabindex="0">
        <div align="center">SPECIAL BULLETIN! (CLICK HERE TO OPEN/CLOSE THIS PANEL)</div>
      </div>
      <div class="CollapsiblePanelContent">
        <p align="center"><a href="https://pirates.maxwell3.com/default.aspx" target="_blank"><img src="images/PirateClubStore.jpg" alt="Visit the Pirate Club Store" width="489" height="55" border="0" /></a></p>
        <p align="center"><a href="https://pirates.maxwell3.com/default.aspx" target="_blank"><img src="images/piratestore.gif" alt="Pirate Club Store" width="700" height="345" border="0" /></a></p>
      </div>
    </div></td>
  </tr>
  <tr valign="middle" bgcolor="#FFDF1C">
    <td bgcolor="#5C3896"><div align="center"><a href="index2.html"><img src="images/logo-pic.jpg" alt="East Carolina University Pirate Club - Click here to go to the home page." width="135" height="166" border="0" /></a></div></td>
    <td bgcolor="#5C3896"><table border="0" align="center" cellpadding="0" cellspacing="0">
      <tr valign="top">
        <td align="center"><table border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td colspan="2"><div align="center"><img src="images/jointheteambehindtheteams400px.jpg" alt="Join the team behind the teams!" width="400" height="75" /></div>
                <div align="right"></div></td>
            </tr>
            <tr>
              <td colspan="2"><script type="text/javascript">
 
/***********************************************
* IFRAME Scroller script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
 
//specify path to your external page:
var iframesrc="http://www.bonesvillemedia.com/pirateclub-v3/external.htm"
 
//You may change most attributes of iframe tag below, such as width and height:
document.write('<iframe id="datamain" src="'+iframesrc+'" width="400px" height="80px" marginwidth="0" marginheight="5" frameborder="0" scrolling="no"></iframe>')
 
    </script></td>
            </tr>
        </table></td>
        </tr>
    </table></td>
    <td width="205" bgcolor="#5C3896"><div align="center"><img src="images/200x155 spaceholder.jpg" width="200" height="155" /></div></td>
  </tr>
  <tr valign="top">
    <td colspan="3" bgcolor="#FFFFFF"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="145" valign="top" bgcolor="#FFF14F"><ul id="MenuBar2" class="MenuBarVertical">
          <li><a href="index.html">Home</a></li>
          <li><a class="MenuBarItemSubmenu" href="#">About the Pirate Club</a>
              <ul>
                <li><a href="about/index.html">General Information</a></li>
                <li><a href="about/mission.html">Our Mission</a></li>
                <li><a href="about/history.html">Our History</a></li>
                <li><a href="about/staff/index.html">Our Staff</a></li>
                <li><a href="about/waystogive.html">Ways to Give</a></li>
              </ul>
          </li>
          <li><a href="#" class="MenuBarItemSubmenu">Pirate Club Chapters</a>
          <ul>
            <li><a href="chapters/index.html">Chapter Information</a></li>
            <li><a href="chapters/chapter_contacts.html">Chapter Contacts</a></li>
            <li><a href="chapters/chapter_map.html">Chapter Map</a></li>
            <li><a href="chapters/letterwinners_chapter.html">The Letterwinners' Chapter</a></li>
          </ul>
      </li>
      <li><a class="MenuBarItemSubmenu" href="#">Pirate Club Membership</a>
          <ul>
            <li><a href="membership/index.html">Membership Levels</a> </li>
            <li><a href="membership/pirateclub.html">Pirate Club (Traditional)</a></li>
            <li><a href="membership/junior_pc.html">Junior Pirate Club</a></li>
            <li><a href="membership/kids_club.html">Chick-fil-A Pirate Kids Club</a></li>
            <li><a href="membership/student_pc.html">Student Pirate Club</a></li>
            <li><a href="membership/younggrad.html">Young Graduate Pirate Club</a></li>
          </ul>
      </li>
      <li><a href="#">Pirates Supporting Pirates</a></li>
      <li><a href="#">Pirate Club News</a></li>
      <li><a href="https://pirates.maxwell3.com/" target="_blank">Pirate Club Store</a></li>
      <li><a href="#">Donate Online</a></li>
      <li><a href="#">Calendar</a></li>
      <li><a href="#">Contact Us</a></li>
        </ul>        
          <p align="center"><a href="popups/2008parking.html" onclick="NewWindow(this.href,'name','300','220','no');return false"><img src="images/left-column-ads/2008-parking-dkprple.jpg" alt="2008 Football Parking" width="147" height="269" border="0" /><br />
          </a><img src="images/PiratesChest/April2008PC.jpg" alt="April 2008 Pirates' Chest" width="147" height="188" /><br />  
            <span class="style6">Get a sneak peek at<br />
            the June/July issue of<br />
            <em>The Pirates' Chest</em>...<br />
  Subscribe today!</span></p>          
          <p align="center" class="style6"><a href="pdf/pc_banner_brochure.pdf" target="_blank"><img src="images/left-column-ads/DrapeGreenvilleInPurpleandGold.jpg" alt="Drape Greenville in Purple &amp; Gold" width="147" height="60" border="0" /></a><br />
            <span class="style6">Display the all-new<br />
Pirate Club Banner<br />
at your business</span></p>
          </td>
        <td valign="top"><!-- InstanceBeginEditable name="MainText" -->
          <table width="100%" border="0" cellpadding="5" cellspacing="0">
  <tr>
    <td valign="top"><p><img src="images/teambehindteams.jpg" alt="The Team Behind the Teams" width="154" height="93" align="left" /><img src="images/the-call.jpg" alt="Answer the Call" width="125" height="286" hspace="5" align="right" /> </p>
      <div align="left" class="style12">
        <p align="left">&nbsp;</p>
        <p align="left">&nbsp;</p>
        <p align="left"><br />
          <span class="style13"><strong><br />
                      The East Carolina University Educational Foundation, Inc., </strong>better   known as the Pirate Club, is the backbone of financial support   for ECU Athletics.<br />
                  <br />
          Funds raised by the Pirate Club from alumni, fans and   friends, go to help fund scholarships for Pirate student-athletes, athletic   facility improvements and other programmatic needs for the university's Division   I athletic program.<br />
          <br />
          If you are interested in ECU Pirate Club membership,   know someone who may be interested, or have not renewed your membership, please <a href="contact.html">contact</a> the Pirate Club at (252)   737-4540 or <a href="http://ev8.evenue.net/cgi-bin/ncommerce3/ExecMacro/evenue/ev67/se/Main.d2w/report?linkID=ecu">make   a pledge</a> online and join &quot;the team behind the teams.&quot;<br />
          <br />
          <strong>Special   Memberships for Everyone</strong><br />
          <a href="membership/kids_club.html">Chick-fil-A Kids   Club<br />
            </a><a href="membership/student_pc.html">Student Pirate Club</a><br />
            <a href="membership/younggrad.html">Young Graduate Pirate Club</a><br />
            <a href="chapters/letterwinners_chapter.html">Letterwinners' Chapter</a><a href="juniorpc.html"><br />
              </a><a href="membership/pirateclub.html">Adult Pirate   Club</a><br />
              <br />
              <strong>Answer the Call</strong><br />
              <a href="pdf/PC%20Application2008revised.pdf">Download the 2008 Pirate Club   Application</a><br />
              <a href="http://ev12.evenue.net/cgi-bin/ncommerce3/DPLanding?linkID=ecu&amp;RSRC=&amp;RDAT=&amp;url=https%3A//ev12.evenue.net/cgi-bin/ncommerce3/DPLanding%3FlinkID%3Decu%26RSRC%3D%26RDAT%3D%26url%3Dhttps%253A//ev12.evenue.net/cgi-bin/ncommerce3/ExecMacro/evenue/ev69/se/Main.d2w/report%253FlinkID%253Decu" target="_blank">Join with a secure online pledge</a><br />
              <a href="/contact.html">Contact the Pirate Club</a><br />
              <br />
              <strong>Ticket Priority   Deadline<br />
                  </strong>Don't forget, May 1 is the deadline for ticket priority for   2008 football. Order your tickets early!</span></p>
        <p align="center"><img src="images/200px_gold_bar.jpg" width="250" height="5" /></p>
        <p align="center" class="style3"><img src="images/chamionscollection-text.jpg" alt="The Champions Collection" width="300" height="47" /></p>
        <p align="center" class="style3"><img src="images/champions-collection.jpg" alt="Champions Collection" width="200" height="254" /></p>
        <p class="style3">2008 marks the 14th edition of the <strong>Champions Collection</strong>.   This years edition features another poem created by ECU alum Al Lockamy based   upon a quote by Leo Jenkins  Above all, I take with me the lasting commitment   to <strong>answer the call</strong> of East Carolina,   whenever and where I can serve.</p>
        <p class="style3">The Pirate Nation are the greatest fans in college athletics, and they must   respond with 110% effort again in 2008.  Pirate fans are always   Champions.</p>
        <span class="style3">Now is your chance to give <strong>110%</strong>, help the Pirate Club   achieve our 2008 goals, and receive your full-color lithograph. (<a href="pdf/CHAMPIONS 2008.pdf" target="_blank">more</a>)</span>
        <p align="left">&nbsp;</p>
      </div></td>
    <td width="262" valign="top" bgcolor="#000000"><table width="215" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td align="center"><span class="style21">
          <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','205','height','155','align','middle','title','PirateClubVideoGreeting','src','video/video','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','video/video' ); //end AC code
            </script>
          <noscript>
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="205" height="155" align="middle" title="PirateClubVideoGreeting">
            <param name="movie" value="video/video.swf" />
            <param name="quality" value="high" />
            <embed src="video/video.swf" width="205" height="155" align="middle" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash"></embed>
          </object>
          </noscript>
        </span></td>
      </tr>
    </table>      
      <p align="center" class="style9 style17"><img src="images/PiratesChest/June-July-200wide.jpg" alt="Get a Sneak Peek at the June/July Pirates' Chest!" width="250" height="324" /><br />
        <img src="images/sneakpeek.jpg" alt="Get a Sneak Peek at This Month's Pirates' Chest " width="250" height="101" /></p>      <table border="0" align="center" cellpadding="5" cellspacing="5">
        <tr>
          <td bgcolor="#FFFFFF" class="style22"><p align="center" class="style9 style17">Pirate Club Announces<br />
            New Travel Partner</p>
              <p align="center" class="style16"><a href="travel/AAA.html"><img src="images/LOGO_AAA.jpg" alt="AAA is ECU Pirate Club's New Travel Partner" width="150" height="90" border="0" align="top" /></a></p>
              <p align="left"><span class="style18"><span class="style14">The ECU Educational Foundation (Pirate Club) and AAA Vacations   have entered into a three-year agreement through December, 2010 that identifies   the award-winning organization as the official travel provider for all Pira</span></span><span class="style5">te   Club travel. </span></p>
              <p align="justify" class="style18"><a href="travel/AAA.html">Click here for more information.</a></p></td>
          </tr>
      </table></td>
    </tr>
</table>
<!-- InstanceEndEditable --></td>
      </tr>
      
    </table></td>
  </tr>
</table>
<table width="100%" border="0" cellpadding="5">
  <tr>
    <td><div align="center"><span class="style1">©2008 East Carolina University Pirate Club. Site created and maintained by Bonesville Media.</span></div></td>
  </tr>
</table>
 
<script type="text/javascript">
<!--
<?php if ($_COOKIE['opensesame'] == 'open') { ?>
var CollapsiblePanel1 = new Spry.Widget.CollapsiblePanel("HomePageAnnouncement",{ contentIsOpen: true } );
<? } else { ?>
var CollapsiblePanel1 = new Spry.Widget.CollapsiblePanel("HomePageAnnouncement",{ contentIsOpen: false } );
<?php } ?>
var MenuBar2 = new Spry.Widget.MenuBar("MenuBar2", {imgRight:"/pirateclub-v3/SpryAssets/SpryMenuBarRightHover.gif"});
//-->
</script>
</body>
<!-- InstanceEnd -->

Open in new window

Hmm.  Can I get a link to a live page to test with, please?  I may have the <php> tags in the wrong spot for IE purposes but I'd need to see it here.
Also, are you previewing from the server or locally?  Previewing a page that depends on PHP evaluating which code to write will likely throw all sorts of errors.  You would need to preview from the server to get a sense of if we are doing it right or wrong.
Here's a live test page. If you'd like, I'll be happy to zip up a scaled down version of this web including only the index3.html page, the associated template and the SpryAssets folder.

http://www.bonesvillemedia.com/pirateclub-v3/index3.html
I don't even need to browse to it.

Because you are testing a .html extension with PHP code, nothing will work because the PHP will not be rendered. The cookie will not be set and the if statements just appear in the middle of a javascript code and generate errors.

Does your server support PHP at all?

If so, rename that page to index3.php and try it.
I've done a remote desktop into the server to check and see and it doesn't look like PHP is enabled. I've sent an e-mail to the guys who manage the server to see if it can be enabled, but it'll take a few minutes for a response.

I've never worked with php before, but I reckon I ought to dig in and learn a little about it now.

I think for now (until I can sort out this whole cookie problem) I'm going to use a work-around, cookie-free solution and just have an index.html page and an index2.html page and the index2.html page will have the collapsible panel set to closed by default and the index.html file will have the collapsible panel set to open by default. I'll set the links that ordinarily would point back to the homepage at index.html to instead point to index2.html.

Hopefully the guys who maintain my server can enable php for my domains.

I'll keep you posted.

Thanks,

Sara
ASKER CERTIFIED SOLUTION
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Good idea. I think this question was under JavaScript, but maybe the whole DreamWeaver/Spry element caused people there not to respond. LOL

I appreciate all your help!
I am sure that this solution would work if I was able to have PHP enabled on my server, but since that's somewhat out of my hands, I can't know for sure. I can't tell you how much I appreciate all of the timely responses on this, though. I've learned something, that's for sure! Hopefully I'll get the missing pieces filled in with a JavaScript-focused question. Thanks again!!!
Ok I just wanted to update you on this...

PHP is now enabled on my server. Here is a link to the PHP page which produces an error.

If you don't want to mess with this anymore, that's cool, but I thought you might be interested:

http://www.bonesvillemedia.com/pirateclub-v3/index3.php
>> Cannot modify header information - headers already sent by (output started at
>> D:\bonesvillemedia\pirateclub-v3\index3.php:1) in D:\bonesvillemedia\pirateclub-v3\index3.php on line 5

Post the source code for the current page, please.  Headers already sent usually indicates a syntax error somewhere.

Also, this is PHP for Windows, right?  Which version?
Version is PHP 5.2.6

And the code is pasted below.
<?php
if (isset($_COOKIE['opensesame'])) {
    $_COOKIE['opensesame'] = 'closed';
} else {
  setcookie("opensesame", "open", time()+28800); // where X is the number of seconds until the cookie expires
}
?>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/homepage-test.dwt" codeOutsideHTMLIsLocked="true" -->
 
<head>
 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>East Carolina University Pirate Club</title>
<!-- InstanceEndEditable -->
<style type="text/css">
<!--
body {
	background-color: #5c3896;
	margin-top: 10px;
	margin-left: 10px;
	margin-right: 10px;
	margin-bottom: 10px;
}
a:link {
	color: #5C3896;
}
a:visited {
	color: #5C3896;
}
a:hover {
	color: #ffdf1c;
}
a:active {
	color: #9966FF;
}
.style1 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: x-small;
	color: #FFFFFF;
}
.style3 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: small;
	color: #000;
}
.style4 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: medium;
	font-weight: bold;
}
.style5 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: small;
}
.style6 {font-family: Arial, Helvetica, sans-serif; font-size: small; font-weight: bold; }
-->
</style>
<script src="scripts/AC_RunActiveContent.js" type="text/javascript"></script>
 
<script src="SpryAssets/SpryCollapsiblePanel.js" type="text/javascript"></script>
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<script language="javascript">
/*
Auto center window script- Eric King (http://redrival.com/eak/index.shtml)
Permission granted to Dynamic Drive to feature script in archive
For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/
 
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}
 
</script>
 
<script type="text/javascript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
<!-- InstanceBeginEditable name="head" -->
 
 
<style type="text/css">
<!--
.style1 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
}
 
.style9 {
	font-size: 14px;
	color: #000000;
}
body {
	margin-left: 0px;
	margin-top: 10px;
	margin-right: 0px;
	margin-bottom: 10px;
}
.style12 {font-family: Arial, Helvetica, sans-serif; color: #000000; }
.style13 {font-size: small}
.style14 {
	color: #000000;
	font-size: small;
}
-->
</style>
<style type="text/css">
<!--
.style16 {	font-family: Arial, Helvetica, sans-serif;
	font-size: x-small;
	color: #FFFFFF;
}
.style16 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: bold;
}
-->
</style>
<style type="text/css">
<!--
.style17 {
	font-size: large;
	font-weight: bold;
	font-family: Arial, Helvetica, sans-serif;
}
-->
</style>
<style type="text/css">
<!--
.style18 {	font-family: Arial, Helvetica, sans-serif;
	font-size: x-small;
	color: #FFFFFF;
}
.style18 {	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
}
-->
</style>
<style type="text/css">
<!--
.style21 {	font-family: Arial, Helvetica, sans-serif;
	font-size: x-small;
	color: #FFFFFF;
}
.style21 {	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
}
-->
</style>
<style type="text/css">
<!--
.style22 {color: #FFFFFF}
-->
</style>
<!-- InstanceEndEditable --><!-- InstanceParam name="src" type="URL" value="about/images/history.jpg" -->
<style type="text/css">
<!--
-->
</style>
 
 
<link href="SpryAssets/SpryCollapsiblePanel.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
-->
</style>
</head>
 
<body>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr valign="top" bgcolor="#FFFFFF">
    <td colspan="3"><div id="HomePageAnnouncement" class="CollapsiblePanel">
      <div class="CollapsiblePanelTab" tabindex="0">
        <div align="center">SPECIAL BULLETIN! (CLICK HERE TO OPEN/CLOSE THIS PANEL)</div>
      </div>
      <div class="CollapsiblePanelContent">
        <p align="center"><a href="https://pirates.maxwell3.com/default.aspx" target="_blank"><img src="images/PirateClubStore.jpg" alt="Visit the Pirate Club Store" width="489" height="55" border="0" /></a></p>
        <p align="center"><a href="https://pirates.maxwell3.com/default.aspx" target="_blank"><img src="images/piratestore.gif" alt="Pirate Club Store" width="700" height="345" border="0" /></a></p>
      </div>
    </div></td>
  </tr>
  <tr valign="middle" bgcolor="#FFDF1C">
    <td bgcolor="#5C3896"><div align="center"><a href="index3.html"><img src="images/logo-pic.jpg" alt="East Carolina University Pirate Club - Click here to go to the home page." width="135" height="166" border="0" /></a></div></td>
    <td bgcolor="#5C3896"><table border="0" align="center" cellpadding="0" cellspacing="0">
      <tr valign="top">
        <td align="center"><table border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td colspan="2"><div align="center"><img src="images/jointheteambehindtheteams400px.jpg" alt="Join the team behind the teams!" width="400" height="75" /></div>
                <div align="right"></div></td>
            </tr>
            <tr>
              <td colspan="2"><script type="text/javascript">
 
/***********************************************
* IFRAME Scroller script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
 
//specify path to your external page:
var iframesrc="http://www.bonesvillemedia.com/pirateclub-v3/external.htm"
 
//You may change most attributes of iframe tag below, such as width and height:
document.write('<iframe id="datamain" src="'+iframesrc+'" width="400px" height="80px" marginwidth="0" marginheight="5" frameborder="0" scrolling="no"></iframe>')
 
    </script></td>
            </tr>
        </table></td>
        </tr>
    </table></td>
    <td width="205" bgcolor="#5C3896"><div align="center"><img src="images/200x155 spaceholder.jpg" width="200" height="155" /></div></td>
  </tr>
  <tr valign="top">
    <td colspan="3" bgcolor="#FFFFFF"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="145" valign="top" bgcolor="#FFF14F"><ul id="MenuBar2" class="MenuBarVertical">
          <li><a href="index3.html">Home</a></li>
          <li><a class="MenuBarItemSubmenu" href="#">About the Pirate Club</a>
              <ul>
                <li><a href="about/index.html">General Information</a></li>
                <li><a href="about/mission.html">Our Mission</a></li>
                <li><a href="about/history.html">Our History</a></li>
                <li><a href="about/staff/index.html">Our Staff</a></li>
                <li><a href="about/waystogive.html">Ways to Give</a></li>
              </ul>
          </li>
          <li><a href="#" class="MenuBarItemSubmenu">Pirate Club Chapters</a>
          <ul>
            <li><a href="chapters/index.html">Chapter Information</a></li>
            <li><a href="chapters/chapter_contacts.html">Chapter Contacts</a></li>
            <li><a href="chapters/chapter_map.html">Chapter Map</a></li>
            <li><a href="chapters/letterwinners_chapter.html">The Letterwinners' Chapter</a></li>
          </ul>
      </li>
      <li><a class="MenuBarItemSubmenu" href="#">Pirate Club Membership</a>
          <ul>
            <li><a href="membership/index.html">Membership Levels</a> </li>
            <li><a href="membership/pirateclub.html">Pirate Club (Traditional)</a></li>
            <li><a href="membership/junior_pc.html">Junior Pirate Club</a></li>
            <li><a href="membership/kids_club.html">Chick-fil-A Pirate Kids Club</a></li>
            <li><a href="membership/student_pc.html">Student Pirate Club</a></li>
            <li><a href="membership/younggrad.html">Young Graduate Pirate Club</a></li>
          </ul>
      </li>
      <li><a href="#">Pirates Supporting Pirates</a></li>
      <li><a href="#">Pirate Club News</a></li>
      <li><a href="https://pirates.maxwell3.com/" target="_blank">Pirate Club Store</a></li>
      <li><a href="#">Donate Online</a></li>
      <li><a href="#">Calendar</a></li>
      <li><a href="#">Contact Us</a></li>
        </ul>        
          <p align="center"><a href="popups/2008parking.html" onclick="NewWindow(this.href,'name','300','220','no');return false"><img src="images/left-column-ads/2008-parking-dkprple.jpg" alt="2008 Football Parking" width="147" height="269" border="0" /><br />
          </a><img src="images/PiratesChest/April2008PC.jpg" alt="April 2008 Pirates' Chest" width="147" height="188" /><br />  
            <span class="style6">Get a sneak peek at<br />
            the June/July issue of<br />
            <em>The Pirates' Chest</em>...<br />
  Subscribe today!</span></p>          
          <p align="center" class="style6"><a href="pdf/pc_banner_brochure.pdf" target="_blank"><img src="images/left-column-ads/DrapeGreenvilleInPurpleandGold.jpg" alt="Drape Greenville in Purple &amp; Gold" width="147" height="60" border="0" /></a><br />
            <span class="style6">Display the all-new<br />
Pirate Club Banner<br />
at your business</span></p>
          </td>
        <td valign="top"><!-- InstanceBeginEditable name="MainText" -->
          <table width="100%" border="0" cellpadding="5" cellspacing="0">
  <tr>
    <td valign="top"><p><img src="images/teambehindteams.jpg" alt="The Team Behind the Teams" width="154" height="93" align="left" /><img src="images/the-call.jpg" alt="Answer the Call" width="125" height="286" hspace="5" align="right" /> </p>
      <div align="left" class="style12">
        <p align="left">&nbsp;</p>
        <p align="left">&nbsp;</p>
        <p align="left"><br />
          <span class="style13"><strong><br />
                      The East Carolina University Educational Foundation, Inc., </strong>better   known as the Pirate Club, is the backbone of financial support   for ECU Athletics.<br />
                  <br />
          Funds raised by the Pirate Club from alumni, fans and   friends, go to help fund scholarships for Pirate student-athletes, athletic   facility improvements and other programmatic needs for the university's Division   I athletic program.<br />
          <br />
          If you are interested in ECU Pirate Club membership,   know someone who may be interested, or have not renewed your membership, please <a href="contact.html">contact</a> the Pirate Club at (252)   737-4540 or <a href="http://ev8.evenue.net/cgi-bin/ncommerce3/ExecMacro/evenue/ev67/se/Main.d2w/report?linkID=ecu">make   a pledge</a> online and join &quot;the team behind the teams.&quot;<br />
          <br />
          <strong>Special   Memberships for Everyone</strong><br />
          <a href="membership/kids_club.html">Chick-fil-A Kids   Club<br />
            </a><a href="membership/student_pc.html">Student Pirate Club</a><br />
            <a href="membership/younggrad.html">Young Graduate Pirate Club</a><br />
            <a href="chapters/letterwinners_chapter.html">Letterwinners' Chapter</a><a href="juniorpc.html"><br />
              </a><a href="membership/pirateclub.html">Adult Pirate   Club</a><br />
              <br />
              <strong>Answer the Call</strong><br />
              <a href="pdf/PC%20Application2008revised.pdf">Download the 2008 Pirate Club   Application</a><br />
              <a href="http://ev12.evenue.net/cgi-bin/ncommerce3/DPLanding?linkID=ecu&amp;RSRC=&amp;RDAT=&amp;url=https%3A//ev12.evenue.net/cgi-bin/ncommerce3/DPLanding%3FlinkID%3Decu%26RSRC%3D%26RDAT%3D%26url%3Dhttps%253A//ev12.evenue.net/cgi-bin/ncommerce3/ExecMacro/evenue/ev69/se/Main.d2w/report%253FlinkID%253Decu" target="_blank">Join with a secure online pledge</a><br />
              <a href="/contact.html">Contact the Pirate Club</a><br />
              <br />
              <strong>Ticket Priority   Deadline<br />
                  </strong>Don't forget, May 1 is the deadline for ticket priority for   2008 football. Order your tickets early!</span></p>
        <p align="center"><img src="images/200px_gold_bar.jpg" width="250" height="5" /></p>
        <p align="center" class="style3"><img src="images/chamionscollection-text.jpg" alt="The Champions Collection" width="300" height="47" /></p>
        <p align="center" class="style3"><img src="images/champions-collection.jpg" alt="Champions Collection" width="200" height="254" /></p>
        <p class="style3">2008 marks the 14th edition of the <strong>Champions Collection</strong>.   This years edition features another poem created by ECU alum Al Lockamy based   upon a quote by Leo Jenkins  Above all, I take with me the lasting commitment   to <strong>answer the call</strong> of East Carolina,   whenever and where I can serve.</p>
        <p class="style3">The Pirate Nation are the greatest fans in college athletics, and they must   respond with 110% effort again in 2008.  Pirate fans are always   Champions.</p>
        <span class="style3">Now is your chance to give <strong>110%</strong>, help the Pirate Club   achieve our 2008 goals, and receive your full-color lithograph. (<a href="pdf/CHAMPIONS 2008.pdf" target="_blank">more</a>)</span>
        <p align="left">&nbsp;</p>
      </div></td>
    <td width="262" valign="top" bgcolor="#000000"><table width="215" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td align="center"><span class="style21">
          <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','205','height','155','align','middle','title','PirateClubVideoGreeting','src','video/video','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','video/video' ); //end AC code
            </script>
          <noscript>
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="205" height="155" align="middle" title="PirateClubVideoGreeting">
            <param name="movie" value="video/video.swf" />
            <param name="quality" value="high" />
            <embed src="video/video.swf" width="205" height="155" align="middle" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash"></embed>
          </object>
          </noscript>
        </span></td>
      </tr>
    </table>      
      <p align="center" class="style9 style17"><img src="images/PiratesChest/June-July-200wide.jpg" alt="Get a Sneak Peek at the June/July Pirates' Chest!" width="250" height="324" /><br />
        <img src="images/sneakpeek.jpg" alt="Get a Sneak Peek at This Month's Pirates' Chest " width="250" height="101" /></p>      <table border="0" align="center" cellpadding="5" cellspacing="5">
        <tr>
          <td bgcolor="#FFFFFF" class="style22"><p align="center" class="style9 style17">Pirate Club Announces<br />
            New Travel Partner</p>
              <p align="center" class="style16"><a href="travel/AAA.html"><img src="images/LOGO_AAA.jpg" alt="AAA is ECU Pirate Club's New Travel Partner" width="150" height="90" border="0" align="top" /></a></p>
              <p align="left"><span class="style18"><span class="style14">The ECU Educational Foundation (Pirate Club) and AAA Vacations   have entered into a three-year agreement through December, 2010 that identifies   the award-winning organization as the official travel provider for all Pira</span></span><span class="style5">te   Club travel. </span></p>
              <p align="justify" class="style18"><a href="travel/AAA.html">Click here for more information.</a></p></td>
          </tr>
      </table></td>
    </tr>
</table>
<!-- InstanceEndEditable --></td>
      </tr>
      
    </table></td>
  </tr>
</table>
<table width="100%" border="0" cellpadding="5">
  <tr>
    <td><div align="center"><span class="style1">©2008 East Carolina University Pirate Club. Site created and maintained by Bonesville Media.</span></div></td>
  </tr>
</table>
 
 
<script type="text/javascript">
<!--
<?php if ($_COOKIE['opensesame'] == 'open') { ?>
var CollapsiblePanel1 = new Spry.Widget.CollapsiblePanel("HomePageAnnouncement",{ contentIsOpen: true } );
<? } else { ?>
var CollapsiblePanel1 = new Spry.Widget.CollapsiblePanel("HomePageAnnouncement",{ contentIsOpen: false } );
<?php } ?>
var MenuBar2 = new Spry.Widget.MenuBar("MenuBar2", {imgRight:"/pirateclub-v3/SpryAssets/SpryMenuBarRightHover.gif"});
//-->
</script>
</body>
 
<!-- InstanceEnd --></html>

Open in new window

Try getting rid of the blank line (line 8)  and the // comment in line 5.  Also check with the server guys to see if cookies are enabled in PHP or create a new page that just has this in it:

<?php phpinfo(); ?>

Name that info.php and load it up on the server and browse to it.  It will produce a ton of info about the PHP environment and tell you if Cookies are enabled or not.
Here's the resulting link from the php info page.

http://www.bonesvillemedia.com/pirateclub-v3/phpinfo.php

And I got rid of the blank line, but no success.
There are only two possibilities for a header already sent error:

1) Some whitespace in the top code is triggering a second header call.  
2) Some content is being written to the page before the header is.

We can establish that #2 is not the issue since we are not asking PHP to echo content.

When I take this source code and load it on my *nix/apache server, it loads up just fine with no PHP errors and the cookie gets set, so it almost has to be a Windows/PHP weird error.

Try removing all line breaks, like so:
 


<?php if (isset($_COOKIE['opensesame'])) {$_COOKIE['opensesame'] = 'closed';} else {setcookie("opensesame", "open", time()+28800); } ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Open in new window

Oh this just keeps getting funnier and funnier. Now that I've gotten that taken care of, it's still giving me an error.

Just check the same link.

http://www.bonesvillemedia.com/pirateclub-v3/index3.php

I'm wondering if this is happening because I put the script code you gave me in my html file rather than my .dwt.

I never could get it to work in my template. But then again, I never tried to produce a php page from my template, either. I tried going from .dwt to .html.
You should be able to add PHP to a template without issues.  I run a bunch of sites that way.  I tend to think this is a Windows/PHP interaction since it works fine for me on the linux side of the fence.

I don't mess with IIS at all and you're beginning to see why.
OK I THINK IT WORKS NOW!!!!!

Let me play with it for a minute or two and I'll let you know for sure!
Great, now we'll need to be sure the cookie check works.
Grrr.... no. It's not that it's working.

I thought it was working because I tried inserting the code directly into the .dwt page rather than the .php page and then I tried re-applying that template to the .php page, but it gave me an error. I clicked past the error thinking it would apply the template data to the page anyway. I uploaded the "corrected" pages and viewed in the browser, but when I went to look at the script, I noticed that the .php page wasn't attached to the right template.

DreamWeaver won't let me.

So it looks like the code would have to be inserted in the .php page, but we've yet to get that to work yet.