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
A weird issue with file caching
Old 03-31-2008, 05:49 PM A weird issue with file caching
Wogan's Avatar
Junior Talker

Posts: 4
Name: Wogan
Location: South Africa
Trades: 0
The script I'm working on is designed to be translated, so I created a basic language file, and all text messages are read from it as per this very basic function:

PHP Code:
function ln_lang() {

    global 
$Site;

    
$langfile 'lang.'.$Site['Lang'];

    
$txt file($langfile);
    
    return 
$txt;

}; 
It's supposed to read the entire file into an array, so that a message can be echoed simply by including $txt[n].

When I created all of this on my Linux box, it worked fine. But now that I've reformatted with Windows, there's something wrong. Changes to the language file don't reflect in the script - not when I add new lines, or delete the existing ones.

I get the feeling that PHP is caching the file somewhere, so I was wondering how to get rid of that caching. And if it's not possible, if there's a simplistic workaround?

~ Wogan
__________________

Please login or register to view this content. Registration is FREE
<- Look! A blog!
Wogan is offline
Reply With Quote
View Public Profile Visit Wogan's homepage!
 
 
Register now for full access!
Old 03-31-2008, 08:46 PM Re: A weird issue with file caching
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
I think it may be how you're calling the function. Try something like this:

PHP Code:
function ln_lang() {

    global 
$Site$txt;

    
$langfile 'lang.'.$Site['Lang'];

    
$txt file($langfile);


__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 04-01-2008, 01:31 AM Re: A weird issue with file caching
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
PHP does not cache files. Look for the problem in another place. Ensure that you edit the same file that the script reads.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 04-01-2008, 08:10 AM Re: A weird issue with file caching
Wogan's Avatar
Junior Talker

Posts: 4
Name: Wogan
Location: South Africa
Trades: 0
At the beginning of the index.php file (which branches off to do everything else in the site), I do this:

PHP Code:
$txt ln_lang(); // Load the Messages variable 
And from there, I use $txt wherever necessary. I'll try your suggestion, but as far as I know, it's supposed to reload the $txt every time index.php is reloaded.

~ Wogan
__________________

Please login or register to view this content. Registration is FREE
<- Look! A blog!
Wogan is offline
Reply With Quote
View Public Profile Visit Wogan's homepage!
 
Reply     « Reply to A weird issue with file caching
 

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.14208 seconds with 12 queries