WAP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreWAP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old October 19th, 2005, 02:03 AM
keidee keidee is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 27 keidee User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 sec
Reputation Power: 0
Sort files by time/date uploaded

Hi..
I just installed this script called WapBuddy.
The index.php file is stated below. Currently, the uploaded files are displayed according to the filename in alphabetical order. I would like the uploaded files to be displayed according to the time uploaded (ie. the latest file will appear first) instead. Is it possible to change the script so that files will be displayed according to date uploaded instead of the filename? Your help would be much appreciated. Thanks!

PHP Code:
<?
header
("Content-type: text/vnd.wap.wml"); 
echo 
"<?xml version=\"1.0\"?>"
echo 
"<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""." \"http://www.wapforum.org/DTD/wml_1.1.xml\">"

include(
"../wapbuddy_settings.php");
if (!isset(
$page)) {$page 0;}
$total 0;

if(!(
$dp opendir("./"))) die ("Cannot open ./");
$file_array = array(); 
while (
$file readdir ($dp))
    {
    if(
substr($file,0,1) != '.' and $file != "index.php")
        {
        
$file_array[] =  $file;
        }
    }
$file_count count ($file_array);
sort ($file_array);
?> 
<wml> 
<card id="card1" title="<? echo $conf["site_name"?>"> 
    <p mode="nowrap">
        <do type="option" label="Home"><go href="../index.php"/></do>
        <? echo "<a href=\"../index.php\">Home</a><br/><br/>"?>
        <?
        
        
if ($file_count 0)
            {
            
$first_record $page $conf["items_per_page"];
            
$last_record $first_record $conf["items_per_page"];
            
            while (list(
$fileIndexValue$file_name) = each ($file_array))
                {
                
                if ((
$fileIndexValue >= $first_record) AND ($fileIndexValue $last_record))
                    {
            
                    echo 
"<a href=\"$file_name\">$file_name</a> ("round(filesize($file_name)/1024,1) . "kb)<br/>";
                    
$total $total filesize($file_name);
                    }
                }
            
            if ((
$file_count 0) AND ($page != 0))
                {
                
// previous button
                
$prev_page $page -1;
                echo 
"<br/><a href=\"".$_SERVER["PHP_SELF"]."?page=$prev_page\">Prev</a><br/>";
                }
            
            
            if ((
$file_count 0) AND ($last_record $file_count))
                {
                
// next button
                
$next_page $page 1;
                echo 
"<br/><a href=\"".$_SERVER["PHP_SELF"]."?page=$next_page\">Next</a><br/>";
                }
            echo 
"<br/>Directory:<br/>$file_count ";
            if (
$file_count == 1)
                {echo 
"file";}
            else
                {echo 
"files";}
                
            echo 
" (" round($total/1024,1) . "kb)";
            echo 
"<br/><a href=\"../index.php\">Home</a>";
            }
        
closedir($dp);
        
?>
        
    </p>
</card> 
</wml>

Reply With Quote
  #2  
Old October 19th, 2005, 08:59 PM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Dev Shed God 8th Plane (8500 - 8999 posts)
 
Join Date: Feb 2002
Location: Finland
Posts: 8,613 jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)  Folding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner Folder
Time spent in forums: 3 Months 3 Weeks 3 Days 5 h 32 m 57 sec
Reputation Power: 1550
Send a message via ICQ to jabba_29 Send a message via AIM to jabba_29 Send a message via MSN to jabba_29 Send a message via Yahoo to jabba_29 Send a message via Google Talk to jabba_29 Send a message via Skype to jabba_29
Facebook
I have never had much luck with this type of thing, but I did a quick google and came up with this script. Untested, but I hope you can incorporate it into your script.
__________________
Cheers,

Jamie


# skiFFie | Home of the 'accessibility module' for Drupal
# Jamie Burns [me] Accessibility Module [drupal]
# guidelines | search | wap resources | not getting help | fold to cure

# Any form of employment is strictly prohibited ......


__________________

Let the might of your compassion arise to bring a quick end
to the flowing stream of the blood and tears .....
Please hear my anguished words of truth.

__________________

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreWAP Programming > Sort files by time/date uploaded


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway