Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
strange behaviour of file_get_content
#1
hello
I'm trying to convert a function I'm using to get page excerpt into a plugin.
I've got some problems with it
In plugin's code when I use
$loaduserfile = @file_get_contents('data/pages/'.$page.'.xml');
and echo the output, I get only content of <pubDate> part of xml file
(example: Mon, 15 Nov 2010 10:41:09 +1030) and not even 1 char more, while function placed in theme/functions.php works fine.

Using
$loaduserfile = @file_get_contents(GSDATAPATH.$page.'.xml');
doesn't load file.

Is there any explanation ?
Addons: blue business theme, Online Visitors, Notepad
Reply
#2
yojoe Wrote:In plugin's code when I use
$loaduserfile = @file_get_contents('data/pages/'.$page.'.xml');
and echo the output, I get only content of <pubDate> part of xml file

Look at the source of the output, you'll see the full xml file.
Or try this: echo htmlspecialchars($loaduserfile);


yojoe Wrote:Using
$loaduserfile = @file_get_contents(GSDATAPATH.$page.'.xml');
doesn't load file.

Is there any explanation ?

Use GSDATAPAGESPATH instead ;-)
Reply
#3
hmmmm....I'm not a pure dev, so I thought I'd get a plain char to char output, and I'll be able to see it as it was fetched.Then I'll see what I can do with it to make it useful.

Thx for a hint about gsdatapagespath, again I don;t $&%(! know why I haven't noticed it on list of constants :\

I feel I have all needed info, and will accomplish v0.00...1 of the plugin.
Addons: blue business theme, Online Visitors, Notepad
Reply




Users browsing this thread: 1 Guest(s)