WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.9 is now available!


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • Droplet -> SiteModifiedAdvancedX
  • Print
Pages: [1]   Go Down

Author Topic: Droplet -> SiteModifiedAdvancedX  (Read 5397 times)

Offline pcwacht

  • Posts: 2923
  • Gender: Male
    • Dutch ICT info
Droplet -> SiteModifiedAdvancedX
« 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) { 
      
$aenderungsdatum= date("H:i ", $mod_details[&#39;modified_when&#39;]);
    
} else {
      
$aenderungsdatum= date("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
Logged
http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • Droplet -> SiteModifiedAdvancedX
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2