Hi,

Attached is a small patch for the mythweb program listing page. It
reduces the use of 'echo', and switches some quotes to ''' from '"' in
some of the more iterative places. This allows php not to waste time
trying to do variable expansion inside double quotes.

Regards,

Shane
--- themes/Default/program_listing.php.orig	2004-12-02 11:58:19.000000000 -0500
+++ themes/Default/program_listing.php	2004-12-02 11:58:51.000000000 -0500
@@ -33,10 +33,11 @@
             <td align="right"><? echo t('Hour') ?>:&nbsp;</td>
             <td><select name="hour" style="text-align: right" onchange="get_element('program_listing').submit()"><?php
                 for ($h=0;$h<24;$h++) {
-                    echo "<option value=\"$h\"";
+                    $s = '<option value="' .$h. '"';
                     if ($h == date('H', $start_time))
-                        echo ' SELECTED';
-                    echo '>'.strftime($_SESSION['time_format'], strtotime("$h:00")).'</option>';
+                        $s .= ' SELECTED';
+                    $s .= '>'.strftime($_SESSION['time_format'], strtotime("$h:00")).'</option>';
+		    echo $s;
                 }
                 ?></select></td>
             <td align="right"><?echo t('Date') ?>:&nbsp;</td>
@@ -50,9 +51,10 @@
                 for ($i=-1;$i<=$max_days;$i++) {
                     $time = mktime(0,0,0, date('m'), date('d') + $i, date('Y'));
                     $date = date("Ymd", $time);
-                    echo "<option value=\"$date\"";
-                    if ($date == date("Ymd", $start_time)) echo " selected";
-                    echo ">".strftime($_SESSION['date_listing_jump'] , $time)."</option>";
+                    $s = '<option value="' .$date. '"';
+                    if ($date == date("Ymd", $start_time)) $s .= ' selected';
+                    $s .= '>'.strftime($_SESSION['date_listing_jump'] , $time).'</option>';
+		    echo $s;
                 }
                 ?></select></td>
             <td align="center"><noscript><input type="submit" class="submit" value="<? echo t('Jump') ?>"></noscript></td>
@@ -197,58 +199,58 @@
             $program_id_counter++;
         // Add a footnote
             global $Footnotes;
-            $Footnotes[] = "<div id=\"program_{$program_id_counter}_popup\" class=\"hidden\">
-<table class=\"menu small\" border=\"1\" cellpadding=\"5\" cellspacing=\"0\">
+            $Footnotes[] = '<div id="program_'.$program_id_counter.'_popup" class="hidden">
+<table class="menu small" border="1" cellpadding="5" cellspacing="0">
 <tr>
-    <td><table class=\"menu small\" cellpadding=\"2\" cellspacing=\"0\">
+    <td><table class="menu small" cellpadding="2" cellspacing="0">
         <tr>
-            <td align=\"right\">".t('Airtime').":</td>
-            <td>".strftime($_SESSION['time_format'], $program->starttime).' to '.strftime($_SESSION['time_format'], $program->endtime)."</td>
+            <td align="right">'.t('Airtime').':</td>
+            <td>'.strftime($_SESSION['time_format'], $program->starttime).' to '.strftime($_SESSION['time_format'], $program->endtime).'</td>
         </tr><tr>
-            <td align=\"right\">".t('Title').":</td>
-            <td>$program->title</td>
-        </tr>"
-        .(strlen($program->subtitle) > 0 ? "<tr>
-            <td align=\"right\">".t('Subtitle').":</td>
-            <td>$program->subtitle</td>
-        </tr>" : '')
-        .(strlen($program->description) > 0 ? "<tr>
-            <td align=\"right\" valign=\"top\">".t('Description').":</td>
-            <td>".nl2br(wordwrap($program->description, 70))."</td>
-        </tr>" : '')
-        .(strlen($program->rating) > 0 ? "<tr>
-            <td align=\"right\" valign=\"top\">".t('Rating').":</td>
-            <td>$program->rating</td>
-        </tr>" : '')
-        .($program->airdate > 0 ? "<tr>
-            <td align=\"right\">".t('Original Airdate').":</td>
-            <td>$program->airdate</td>
-        </tr>" : '')
-        .(strlen($program->category) > 0 ? "<tr>
-            <td align=\"right\">".t('Category').":</td>
-            <td>$program->category</td>
-        </tr>" : '')
-        .($program->previouslyshown ? "<tr>
-            <td align=\"right\">".t('Rerun').":</td>
+            <td align="right">'.t('Title').':</td>
+            <td>'.$program->title.'</td>
+        </tr>'
+        .(strlen($program->subtitle) > 0 ? '<tr>
+            <td align="right">'.t('Subtitle').':</td>
+            <td>'.$program->subtitle.'</td>
+        </tr>' : '')
+        .(strlen($program->description) > 0 ? '<tr>
+            <td align="right" valign="top">'.t('Description').':</td>
+            <td>'.nl2br(wordwrap($program->description, 70)).'</td>
+        </tr>' : '')
+        .(strlen($program->rating) > 0 ? '<tr>
+            <td align="right" valign="top">'.t('Rating').':</td>
+            <td>'.$program->rating.'</td>
+        </tr>' : '')
+        .($program->airdate > 0 ? '<tr>
+            <td align="right">'.t('Original Airdate').':</td>
+            <td>'.$program->airdate.'</td>
+        </tr>' : '')
+        .(strlen($program->category) > 0 ? '<tr>
+            <td align="right">'.t('Category').':</td>
+            <td>'.$program->category.'</td>
+        </tr>' : '')
+        .($program->previouslyshown ? '<tr>
+            <td align="right">'.t('Rerun').':</td>
             <td>Yes</td>
-        </tr>" : '')
-        .($program->will_record ? "<tr>
-            <td align=\"right\">".t('Schedule').":</td>
-            <td>".($program->record_daily       ? t('rectype-long: daily')
+        </tr>' : '')
+        .($program->will_record ? '<tr>
+            <td align="right">'.t('Schedule').':</td>
+            <td>'.($program->record_daily       ? t('rectype-long: daily')
                     : ($program->record_weekly  ? t('rectype-long: weekly')
                     : ($program->record_once    ? t('rectype-long: once')
                     : ($program->record_channel ? t('rectype-long: channel')
                     : ($program->record_findone ? t('rectype-long: findone')
-                    : t('rectype-long: always'))))))."</td>
-        </tr>" : '')
-        .($program->recstatus ? "<tr>
-            <td align=\"right\">".t('Notes').":</td>
-            <td>".$GLOBALS['RecStatus_Reasons'][$program->recstatus]."</td>
-        </tr>" : '')
-        ."</table></td>
+                    : t('rectype-long: always')))))).'</td>
+        </tr>' : '')
+        .($program->recstatus ? '<tr>
+            <td align="right">'.t('Notes').':</td>
+            <td>'.$GLOBALS['RecStatus_Reasons'][$program->recstatus].'</td>
+        </tr>' : '')
+        .'</table></td>
 </tr>
 </table>
-</div>";
+</div>';
         }
 
 // then, we just display the info
@@ -267,11 +269,11 @@
             $mouseover .= 'hide();';
         $mouseover .= 'return true;"';
     // Print a link to record this show
-        echo '<a id="program_'.$program_id_counter.'" href="program_detail.php?chanid='.$program->chanid.'&starttime='.$program->starttime.'"'.$mouseover.'>';
+        $s = '<a id="program_'.$program_id_counter.'" href="program_detail.php?chanid='.$program->chanid.'&starttime='.$program->starttime.'"'.$mouseover.'>';
 
     // Is this program 'Already in Progress'?
         if ($program->starttime < $GLOBALS['list_starttime'])
-            echo '<img src="themes/Default/img/leftwhite.png" border="0">';
+            $s .= '<img src="themes/Default/img/leftwhite.png" border="0">';
 
     // Does this program 'Continue'?
         $right_arrow = '';
@@ -279,19 +281,20 @@
             $right_arrow = '<img src="themes/Default/img/rightwhite.png" border="0">';
 
         if ($percent > 5) {
-            echo $program->title;
+            $s .= $program->title;
             if (strlen($program->subtitle) > 0) {
                 if ($percent > 8)
-                    echo ":$right_arrow<BR>$program->subtitle";
+                    $s .= ':'.$right_arrow.'<BR>'.$program->subtitle;
                 else
-                    echo ': ...'.$right_arrow;
+                    $s .= ': ...'.$right_arrow;
             }
             else
-                echo $right_arrow;
+                $s .= $right_arrow;
         }
         else
-            echo '...'.$right_arrow;
-        echo '</a>';
+            $s .= '...'.$right_arrow;
+        $s .= '</a>';
+	echo $s;
 
     // Print some additional information for movies
         if ($program->category_type == 'movie'
@@ -300,28 +303,28 @@
                 $parens = sprintf('%4d', $program->airdate);
             if (strlen($program->rating) > 0) {
                 if ($parens)
-                    $parens .= ", ";
-                $parens .= "<i>$program->rating</i>";
+                    $parens .= ', ';
+                $parens .= '<i>'.$program->rating.'</i>';
             }
             if (strlen($program->starstring) > 0) {
                 if ($parens)
-                    $parens .= ", ";
+                    $parens .= ', ';
                 $parens .= $program->starstring;
             }
             if ($parens)
                 echo " ($parens)";
         }
-	$parens = "";
+	$parens = '';
     // Finally, print some other information
         if ($program->previouslyshown)
-            $parens = "<i>Rerun</i>";
+            $parens = '<i>Rerun</i>';
         if ($program->hdtv) {
             if ($parens)
-                $parens .= ", ";
-            $parens .=  "<font color=\"yellow\"><b>HD</b></font>";
+                $parens .= ', ';
+            $parens .=  '<font color=\"yellow\"><b>HD</b></font>';
 	}
         if ($parens)
-            echo "<BR>($parens)";
+            echo '<BR>('.$parens.')';
 
     ?></td>
 <?php
_______________________________________________
mythtv-dev mailing list
[EMAIL PROTECTED]
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev

Reply via email to