Jump to content
php.lv forumi

Nerāda kā vajag postus.


Cibiņš

Recommended Posts

Tatad man šis skripts atspoguļo postus. Bet kā var izdarīt lai parāda lapā 5 postus? Ja ir teiksim vairāk par 5 postiem tad pēdējie 5 jaunakie posti paliek, savukārt vecākie tā kā pāriet uz arhīviem un apakšā ir poga "Arhīvs" zem 5 jaunākajiem postiem ???

 

   <table border="0" cellpadding="0" cellspacing="0">
     <tr>
       <td><?php
   if (!isset($_GET['MBID'])) exit;  

       function showpost(&$parent) {
       extract($parent, EXTR_PREFIX_ALL, "msg");
 $msg_DateSubmitted = date("d. F Y", $msg_DateSubmitted);
?>
<tr>
       <td rowspan="2" class="dateActual"><p class="dateActual2"><?php echo "$msg_DateSubmitted" ?></p></td>
       <td class="actAreas"><?php echo "$msg_Title" ?>
       <br /></td>
       <td rowspan="2" class="arrowAreaAd"><img src="../resources/pictures/_pic/arrow.png" alt="arrow" width="15" height="86" /></td>
       <td rowspan="2" class="pictureAreaActual"><?php echo "$msg_Picture" ?></td>
     	</tr>
     	<tr>
     	  <td class="readMore"><a class="actLinks" href="?pg=read&Msg=<? echo "$msg_ID" ?>">› lasīt vairāk</a></td>
   	  </tr>
     	<tr>
       <td colspan="4"><div class="lineDiv"></div></td>
       </tr>
<?	


       $result = mysql_query("SELECT ID, Title, Picture, DateSubmitted FROM pg_home_data WHERE MBID = {$_GET['MBID']} AND Parent = $msg_ID ORDER BY DateSubmitted DESC;");

       if (mysql_num_rows($result)) {
          while ($row = mysql_fetch_assoc($result)) {
               showpost($row);
           }
       }
   }

   $result = mysql_query("SELECT ID, Title, Picture, DateSubmitted FROM pg_home_data WHERE MBID = {$_GET['MBID']} AND Parent = 0 ORDER BY DateSubmitted DESC;");
   if (!$result) exit;
   if (!mysql_num_rows($result)) {
       echo "<p class='dateActual2'>Pagaidām nav ievietotu rakstu!</p>";
   } else {
       while ($row = mysql_fetch_assoc($result)) {
           showpost($row);
       }
   }
?></td>
     </tr>
     <tr>
       <td id="bufferDnAreaControl">
       <a class="actLinks" href="#">›› Aktualitāšu arhīvs</a>    // Šis paradās ja ir vairak par 5 rakstiem lapā un dodas uz arhīvu kur ir vecāki raksti.
      </td>
     </tr>
     <tr>
       <td id="bufferDnArea"></td>
     </tr>
   </table>

Edited by MCWeb.lv
Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...