PHP forums, MySQL forums, Web Development resources

Home PageHome    PHP ResourcesTopic List    FAQFAQ    SearchSearch    MemberlistMemberlist    UsergroupsUsergroups 
 RegisterRegister
    ProfileProfile    Log in to check your private messagesLog in to check your private messages    Download the RSS Reader RSS Feed Download the RSS Reader RSS for this forum Log inLog in 

PHP Forum :: MySQL Forum :: Java Script Forum



Use getdate() to rename file

 
Post new topic   Reply to topic    WeberForums.com Forum Index -> PHP General
View previous topic :: View next topic  
Author Message
jaketribble



Joined: 30 Dec 2006
Posts: 1

PostPosted: Sat Dec 30, 2006 3:36 pm    Post subject: Use getdate() to rename file Reply with quote

Can somebody help me with an example of php script?
I want to use getdate(mday) to rename a specific file according to the day of the month
Example; filename=datedfile.php

$dates = getdate();
if($dates['mday']=="30") /30th day of month

---THEN I need to do this--

$do = unlink("daily.html"); /daily.html is a specific file for that day

$file = 'daily30.html';
$newfile = 'daily.html';
if (copy($file, $newfile))


--I have 31 files---1 for each day of the month
When a browser requests daily.html---the php code in datedfile.php
will check for the day of the month and then copy the correct file.

OR if somebody has a better way to get this accomplished
THEN Please help me, PLEASE? Smile
Back to top
View user's profile Send private message Send e-mail
serpentskiss



Joined: 10 Jan 2007
Posts: 9

PostPosted: Wed Jan 10, 2007 8:35 pm    Post subject: Reply with quote

Bit long winded. Why not

Code:
$file = date("d").'html';
include($file);


or

Code:
$file = date("d").'html';
$myFile = file($file);
echo $myFile;


Then, if your files are called 01.html, 02.html, 03.html .... 30.html, 31.html, then you will be setting the variable $file to be whatever the day is eg 10.html
Back to top
View user's profile Send private message
Display posts from previous:   
WeberTrivia Questions WeberTrivia Questions
 Think you are smart? Prove it!. Try your skills with these questions :
 WeberTrivia QuestionsRecursive arrays and multi-dimensional arrays are one and the same. (PHP and MySQL)
 WeberTrivia QuestionsThe \"cache_dir\" tag of the squid configuration has a default of /var/spool/squid. (Linux)

WeberTrivia Questions



Post new topic   Reply to topic    WeberForums.com Forum Index -> PHP General All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Powered by phpBB © 2001, 2005 phpBB Group
PHP Forum :: MySQL Forum :: Java Script Forum