Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Automatically updating php file, avoid includes
Old 07-15-2006, 01:16 PM Automatically updating php file, avoid includes
Yak Yak Yak Yak Yak

Posts: 593
Location: Rochester, MN
Trades: 0
Is there a way to make a php file update itself periodically, by importing a txt file, which contains a portion of the script that updates periodically?

So basically, every day at the same time, this script would import the txt file, and replace a portion of itself with this updated file?

The desired effect is to update the php file directly with the information. So, instead of something that looks like this:
PHP Code:
<?php
other script content
include("1.php");
other script content
?>
It would instead look like this
PHP Code:
<?php
other script content
text periodically imported to this location
other script content
?>
Thus, eliminating the need for most server side includes.
__________________

Please login or register to view this content. Registration is FREE
neorunner is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-15-2006, 07:51 PM Re: Automatically updating php file, avoid includes
Kiros72's Avatar
Average Talker

Posts: 18
Name: Kiros
Location: Albany, LA - USA
Trades: 0
Hmmm... Well, I don't have much PHP coding experience yet, but I think that you could use the Date function to return the day and use it inside a switch. The only thing you would need in this case would be 7 cases (if you go by the days) or 28 cases (if you go by the day's number) - 28 because that's the lowest and you could just use the default switch otherwise.

Erm... I think that this would only be a reasonable method if you know the file names you want to include for the different days. If you use the Date function to return the day of the week (Mon, Tue, etc.) then you could make the 7 cases with the default switch. The only maintenance would be either changing each case each week (which would be a little bit of a hassle) or to upload the 7 new files each week and override the old files without changing the names (less of a hassle). Unfortunately, the less of a hassle also has it's downside, as it takes more effort to archive the old files, and if you forget to archive them one week, they're gone (at least on the server).
Kiros72 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Automatically updating php file, avoid includes
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11911 seconds with 12 queries