It is currently Sat Feb 04, 2012 3:37 pm

All times are UTC + 2 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Use getdate() to rename file
PostPosted: Sat Dec 30, 2006 4:36 pm 
Offline

Joined: Sat Dec 30, 2006 4:03 pm
Posts: 1
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? :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 10, 2007 9:35 pm 
Offline

Joined: Wed Jan 10, 2007 9:31 pm
Posts: 9
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 2 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


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

Search for:
Jump to:  
cron