WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Droplets & Snippets => Topic started by: pcwacht on November 04, 2009, 11:48:43 AM

Title: Droplet -> SiteModifiedAdvancedX
Post by: pcwacht on November 04, 2009, 11:48:43 AM
I needed a list of pages whith last x modified pages

Used the droplet SiteModifiedX but wasn't happy with it -> http://www.websitebakers.com/pages/droplets/official-library/information/site-modified-x.php
The snippet Last Modified Pages Advanced was more what I need -> http://www.websitebakers.com/pages/code-snippets/listings/last-mod-pages-adv..php

So I merged the two ;)

Code: [Select]
<?php 
global $database$wb;
$links "";
$heute floor(time() / 86400);
$bisher = -1;

if(!isset(
$x)){$x=10;};
if (
PAGE_ID>0) {
  
$query $database->query("SELECT modified_when, link,page_title WHERE visibility=&#39;public&#39;  FROM ".TABLE_PREFIX."pages order by modified_when desc limit $x");
  while(
$mod_details=$query->fetchRow()){
    
$tag =floor($mod_details[&#39;modified_when&#39;] / 86400);  
    
$aktuell $heute $tag;
    if (
$aktuell 3) { $aktuell 3; }
    if (
$aktuell 3) { 
      
$aenderungsdatumdate("H:i "$mod_details[&#39;modified_when&#39;]);
    
} else {
      
$aenderungsdatumdate("d. M Y "$mod_details[&#39;modified_when&#39;]);
    
}
    
$weblink=$mod_details[&#39;link&#39;];
    
$cutzeichen=strrpos($weblink,"/");
    
$weblinktext substr($weblink,0,$cutzeichen);
    if (
$weblinktext == "")
    {
      
$weblink_text "(in Mainmenu)";
    }
    else
    {
      
$weblink_text "(in " .  str_replace(&#39;/&#39;, &#39; > &#39;, $weblinktext) . ")";
    
}
    if (
$bisher <> $aktuell)
    {
      
$bisher $aktuell;
      switch (
$aktuell)
      {
         case 
0$links.= "<h4 class=&#39;lastchanges&#39;>Today:</h4>\n"; break;
         case 
1$links.= "<h4 class=&#39;lastchanges&#39;>Yesterday:</h4>\n"; break;
         case 
2$links.= "<h4 class=&#39;lastchanges&#39;>Day before yesterday:</h4>\n"; break;
         case 
3$links.= "<h4 class=&#39;lastchanges&#39;>Older then three days:</h4>\n"; break;
      }
    }
    
$links.=  $aenderungsdatum ." &nbsp; <a href=\"" .  WB_URL PAGES_DIRECTORY "$weblink.php\"><b>" $mod_details[&#39;page_title&#39;] . "</b></a> ". $weblink_text . "<br />\n";
  
}
  return 
$links;
}


It can use one optional parameter $x for number of pages to show, if omitted 10 are shown.
call: [[SiteModifiedAdvancedX?x=15]]


Have fun,
John