Jump to content

[SOLVED] PHP + Heredoc appear to not process all divs


Styles2304

Recommended Posts

The coding:

        if ($EventData[$i][$EventSelect]['TBD']) {
          $EventEOD .=<<<EOD
            <div class="$Class">
              <div class="roundcorner_small_tl"><img src="images/calendar/round_corner_small.png" alt=""></div>
              <div class="roundcorner_small_tr"><img src="images/calendar/round_corner_small.png" alt=""></div>
              <div class="roundcorner_small_bl"><img src="images/calendar/round_corner_small.png" alt=""></div>
              <div class="roundcorner_small_br"><img src="images/calendar/round_corner_small.png" alt=""></div>
              <font class="event"><a href="index.htm" onclick="return hs.htmlExpand(this)" class="tbd">$DisplayTitle</a>
              <div class="highslide-maincontent">
                <font class="$Class" style="font-weight: bold; font-size: 14px;">
                  $Title <br>
                </font>
                $Date <br> <br>
                $Description
              </div>
              </font><br>
            </div>
EOD;

 

The Explanation

If an event is entered into the database with no designated time, it is marked as TBD which then wraps the event text in a div as opposed to just plain text - it's a blatant rip off of the google calendar and how a scheduled event looks if it's an "all day event".

 

The Problem:

If I have more than 2 TBD events on the same day, only two of the div'd events will display. The third will simply not process as weird as it sounds. I thought, initially, that it was hidden somewhere given the delicate nature of divs but if I view the source, it is no where to be found.

 

Any ideas?

Note: here's the problem page: omega.clanhqhosting.net/~jami/calendar.php

There is actually a "Testing 1" on the 7th that should be displayed right along with "Special Olympics" and "Testing 3".

  //Calendar Build Begins Here
  $EventEOD ='';
  $EventEOD .=<<<EOD
    <div class="c2">
      <table width="784px" cellspacing="0" cellpadding="0" border="0">
        <tr>
EOD;
  for ($i = 1; $i < $numDays + 1; $i++, $counter++) {
    $timeStamp = strtotime("$year-$month-$i");

    if ($i == 1) {
    //Figures out when the first day of the month is
      $firstDay = date("w",$timeStamp);
    //Checks day of the week for first day.
      for($j = 0; $j < $firstDay; $j ++, $counter++) {
        $EventEOD .=<<<EOD
          <td width="110px" height="103px" valign="top" align="center">&#160;</td>
EOD;
      }
    }

    if(($counter % 7 == 0) && ($counter != 0)) {
      $rowcount++;
      $EventEOD .=<<<EOD
        </tr>
        <tr>
EOD;
    }
    
    if (($i == date("j")) && ($month == date("m")) && ($year == date("Y"))) {
      $EventEOD .=<<<EOD
        <td width="110px" height="103px" valign="top" align="center">
          <div class="date_header_today">
            <div class="roundcorner_small_tl_2"><img src="images/calendar/round_corner_small_blue.png" alt=""></div>
            <div class="roundcorner_small_tr_2"><img src="images/calendar/round_corner_small_blue.png" alt=""></div>
            <font class="days_today">$i</font>
          </div>
EOD;
    } else {
      $EventEOD .=<<<EOD
        <td width="110px" height="103px" valign="top" align="center">
          <div class="date_header">
            <div class="roundcorner_small_tl_2"><img src="images/calendar/round_corner_small_blue.png" alt=""></div>
            <div class="roundcorner_small_tr_2"><img src="images/calendar/round_corner_small_blue.png" alt=""></div>
            <font class="days">$i</font>
          </div>
EOD;
    }

    if ($EventData[$i]) {
      $EventEOD .=<<<EOD
        <div class="date">
          <div class="roundcorner_small_bl_2"><img src="images/calendar/round_corner_small_blue.png" alt=""></div>
          <div class="roundcorner_small_br_2"><img src="images/calendar/round_corner_small_blue.png" alt=""></div>
EOD;
      
      for ($EventCount = 0; ($EventCount <= count($EventData[$i]['EventCount']) - 1) && $EventCount < 4; $EventCount++) {
        $EventSelect = $EventData[$i]['EventCount'][$EventCount];
        $Class = $EventData[$i][$EventSelect]['Class'];
        $DisplayTitle = $EventData[$i][$EventSelect]['DisplayTitle'];
        $Title = $EventData[$i][$EventSelect]['Title'];
        $Date = date('l\, F jS', mktime(0, 0, 0, $EventData[$i][$EventSelect]['EMonth'], $EventData[$i][$EventSelect]['EDay'], $EventData[$i][$EventSelect]['EYear']));
        $Time = $EventData[$i][$EventSelect]['FullTime'];
        $Description = $EventData[$i][$EventSelect]['Description'];
        
        if ($EventData[$i][$EventSelect]['TBD']) {
          $EventEOD .=<<<EOD
            <div class="$Class">
              <div class="roundcorner_small_tl"><img src="images/calendar/round_corner_small.png" alt=""></div>
              <div class="roundcorner_small_tr"><img src="images/calendar/round_corner_small.png" alt=""></div>
              <div class="roundcorner_small_bl"><img src="images/calendar/round_corner_small.png" alt=""></div>
              <div class="roundcorner_small_br"><img src="images/calendar/round_corner_small.png" alt=""></div>
              <font class="event"><a href="index.htm" onclick="return hs.htmlExpand(this)" class="tbd">$DisplayTitle</a>
              <div class="highslide-maincontent">
                <font class="$Class" style="font-weight: bold; font-size: 14px;">
                  $Title <br>
                </font>
                $Date <br> <br>
                $Description
              </div>
              </font><br>
            </div>
EOD;
        
        } else {
        
        $EventEOD .=<<<EOD
          &#160;<font class="event"><a href="index.htm" onclick="return hs.htmlExpand(this)" class="$Class">$DisplayTitle</a>
          <div class="highslide-maincontent">
            <font class="$Class" style="font-weight: bold; font-size: 14px;">
              $Title <br>
            </font>
            $Date <br>
            $Time <br> <br>
            $Description
          </div>
          </font><br>
EOD;
        }
      }
      
      $EventEOD .=<<<EOD
        </div></td>
EOD;
    } else {
      $EventEOD .=<<<EOD
        <div class="date">
          <div class="roundcorner_small_bl_2"><img src="images/calendar/round_corner_small_blue.png" alt=""></div>
          <div class="roundcorner_small_br_2"><img src="images/calendar/round_corner_small_blue.png" alt=""></div>
        </div></td>
EOD;
    }
  }

  $EventEOD .=<<<EOD
            </tr>
      </table>
    </div>
  </div>
</div>
EOD;

 

That should pretty much cover anything. Also, I did a dump of $EventData just to make sure that all of the data was being retrieved from the database and it was.

      for ($EventCount = 0; ($EventCount <= count($EventData[$i]['EventCount']) - 1) && $EventCount < 4; $EventCount++) {
        $EventSelect = $EventData[$i]['EventCount'][$EventCount];
//blah blah...
        
        if ($EventData[$i][$EventSelect]['TBD']) {

 

if ( isSet ($EventSelect['TBD']) )
{

//???

}

      for ($EventCount = 0; ($EventCount <= count($EventData[$i]['EventCount']) - 1) && $EventCount < 4; $EventCount++) {
        $EventSelect = $EventData[$i]['EventCount'][$EventCount];
//blah blah...
        
        if ($EventData[$i][$EventSelect]['TBD']) {

 

if ( isSet ($EventSelect['TBD']) )
{

//???

}

 

This didn't change anything,

 

 

 

for ($EventCount = 0; ($EventCount <= count($EventData[$i]['EventCount']) - 1) && $EventCount < 4; $EventCount++) {

What's the point of the && $EventCount < 4?

 

It limits the amount of events displayed in each cell.

No, it doesn't. Sort of a relief since that means I wrote at least that part of the code accurately. It seems to only have a problem when it's the TBD events like I said earlier. If they're regularly scheduled events, they work and display fine.

Archived

This topic is now archived and is closed to further replies.

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