file_get_contents in dwt template

I have the following code in my dreamweaver template:

echo file_get_contents("test.txt");

The problem is that when I have pages at different levels of the file system hierarchy, this code doesn't work correctly (it doesn't rewrite itself to have the right path). I have tried to use the full http path but that doesn't work either.

Note that I CANNOT use include instead of the file_get_contents, as this is not allowed by my IT group.
Who is Participating?
Jason C. LevineConnect With a Mentor No oneCommented:
Hi karimjohnson,

So the problem is that DW's regex engine knows to look at include() and require() and change those paths as the page is moved around in the file structure but it doesn't respect file_get_contents()

If a URL doesn't work, then your IT folks have disable fopen() as well.  Instead of an http full path, use a full server path and see if you get the correct results.  It would look something like this:

Ray PaseurCommented:
You might want to look into these PHP functions and read the user-contributed notes.

Best to all, ~Ray
karimjohnsonAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.