Added ability to change number of articles shown on portal.
authorDan
Mon, 20 Apr 2009 08:33:59 -0400
changeset 16 3d96dbb770b5
parent 15 f0cf0b512fbb
child 17 f6edf51a9479
Added ability to change number of articles shown on portal.
plugins/Newsboy.php
--- a/plugins/Newsboy.php	Thu Apr 16 22:48:15 2009 -0400
+++ b/plugins/Newsboy.php	Mon Apr 20 08:33:59 2009 -0400
@@ -428,12 +428,14 @@
   if ( !$q )
     $db->_die();
   
+  $num_articles = intval(getConfig('nb_portal_num_articles', 5));
+  
   if ( $row = $db->fetchrow() )
   {
     $i = 0;
     do
     {
-      if ( $i < 5 )
+      if ( $i < $num_articles )
       {
         $content = $row['page_text'];
         
@@ -1101,6 +1103,11 @@
       setConfig('nb_announce_page', $_POST['announce_page']);
     else
       setConfig('nb_announce_page', '');
+    
+    $num_articles = intval($_POST['num_articles']);
+    if ( $num_articles > 0 )
+      setConfig('nb_portal_num_articles', $num_articles);
+    
     // Submit
     echo '<div class="info-box">Your changes have been saved.</div>';
   }
@@ -1131,6 +1138,14 @@
               </td>
             </tr>
             <tr>
+              <td class="row2">
+                Number of articles to show on portal:
+              </td>
+              <td class="row1">
+                <input type="text" name="num_articles" value="' . getConfig('nb_portal_num_articles', '5') . '" size="7" />
+              </td>
+            </tr>
+            <tr>
               <th class="subhead" colspan="2">
                 <input type="submit" name="submit" value="Save changes" />
               </th>