I want to something like
include ($siteURL."myFile.inc");

I mean I want to do an include of a file after concating that with a variable.
But I am unable to do so, please help me and thanks in anticipation.

[p.s. I search the forum but with too many confusing results.]

    $filename=$siteURL."myFile.inc";

    if (file_exists($filename)) {
    include ($filename);
    } else {
    echo "CANT INCLUDE the file $filename~~ file not exist";
    }

    hope that helps

      <?php
      $siteURL = "http://localhost/brajeshwar/";
      $filename = $siteURL."temp.inc";
      if (file_exists($filename)) {
      include ($filename);
      } else {
      echo "The list of Flash blogs seem to have some problem.";
      }
      ?>

      Now the nice part is that it is showing the one that we do not like "the list of flash blogs seem to have some problem".

      actually my $siteURL and a couple of other variables have been defined in a single PHP file that is included in every page. So I was thinking concatenating here will do the trick but nope.

      Thanks for the help so far, I still need a working example or something or is there any hidden tip that I have to consider.

        OK...you have seen several possible solutions--and apparently none have worked. Are you getting an error? Try things like printing out the filename (I always end up forgetting the slash between the dir and the filename)--is the code working, but throwing you into the else?...what results have you had?

          If the file is local, use a relative path, not an http URI.

            Write a Reply...