• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 341
  • Last Modified:

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.
1 Solution
Jason C. LevineNo 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:

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now