I’ve been busy hacking the code on somebody’s site.  I just wanna mention the fopen command in PHP.  And how you shouldn’t use it.  It’s frightfully frail, and there’s little to no information on how to make it work.  And sometimes webhosts disable it in the php.ini config, so it doesn’t always work.    Use $data = file_get_contents(“some_random_file.file”) instead to put the contents int a variable.  If you need to make an array from it,$ array = explode (“n”, $data);  instead of fget.  Then call $items_in_array= count($array) – 1; to get the total number of items in the array.  Its a little more wordy, but I think has the same number of lines as the while() loop would require.

Just don’t use fopen.  Please.  Its buggy at best, and possible maybe seemingly unusable in wordpress.  Which is why I had to convert my code from using fopen to file_get_contents.

One more note.  A function’s “present working directory” in wordpress is the directory it’s installed to.  echo getcwd(); as proof 🙂  Which, if I say so myself and I will is stupid.  Total stupid.