Login   Register  
PHP Classes
elePHPant
Icontem

File: test_new_label.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Peter Klauer  >  new_label  >  test_new_label.php  >  Download  
File: test_new_label.php
Role: Example script
Content type: text/plain
Description: a demo file
Class: new_label
Label new items with "new" for a number of days.
Author: By
Last change: Minor changes.
Date: 12 years ago
Size: 1,486 bytes
 

Contents

Class file image Download
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title></title>
</head>
<body style="font-family:arial,sans-serif" bgcolor=white text=black link=navy vlink="maroon">
<a href="http://www.ingoknito.de" style="font-family:Comic Sans MS, sans-serif;font-size:17pt;">www.ingoknito.de</a><br>
<br>

<h4>Test page for class new_label</h4>

<?php
    
include 'inc_new_label.php';
    
    
$numdays 5// <-- change this value
    
    
$nl = new new_label;

    echo 
"The value \$days is set to $numdays.<br><br>";    
            
    for( 
$i 9$i >=1$i-- )
    {
        
$oldest date('Y-m-d',
        
mktime0,0,0
        
date('m'),
        
date('d')-$i
        
date('Y')));
    
        echo 
"day $i$oldest "// <-- this simulates an item to label with "new"
        
        
$nl->put$oldest$numdays ); // <-- here comes the label (when the item is new!)
        
        
echo '<br>';
    }        
    echo 
"<br>This example shows how the label \"new\" will automatically disappear after $numdays days.";
?>
This demo is quite a bit wired, I know. But I hope you understand what I mean.<br>
To use this class in it's simplest way just put the creation date of your 
item to label. The default expiring number of days is 30.
<blockquote>
$nl-&gt;put( '<?php echo date('Y-m-d'); ?>' ); <?php $nl->putdate('Y-m-d')); ?>
</blockquote>      
</body>
</html>