Include Problem ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Xav

    Include Problem ?

    Why does this not work ?

    $fileDir = '../folder2/';
    $content is an array of php files, file1.php file2.php file3.php
    etc...

    $c = count($content) ;
    for( $x=0; $x<$c; $x++ ){
    include( $fileDir.$conte nt[$x] );
    }

    any ideas would be appreciated,
    thanks.
    Xav

  • Xav

    #2
    Re: Include Problem ?

    this seems to work,

    ....
    for( $x=0; $x<$c; $x++ ){
    include( $fileDir.'file' .($x+1).'.php' );

    }
    ....

    I don't understand why the other won't !
    ???

    Xav

    Comment

    • Thomas Hamacher

      #3
      Re: Include Problem ?

      Xav schrieb:
      Why does this not work ?
      $fileDir = '../folder2/';
      $content is an array of php files, file1.php file2.php file3.php
      etc...
      $c = count($content) ;
      for( $x=0; $x<$c; $x++ ){
      include( $fileDir.$conte nt[$x] );
      }
      This should work if $content really contains what you expect.

      var_dump($conte nt);

      Comment

      • Xav

        #4
        Re: Include Problem ?

        I did the <pre>...</prething...
        it shows;

        [0] =file1.php
        [1] =file2.php
        etc...

        as expected!

        I think I found a Bug!

        this really doesn't work, I was thinking my logic was at fault,

        could it be a php.ini setting problem ? I don't know of any settings
        that govern logic.

        thanks for response,
        Xav

        Comment

        • Rik Wasmus

          #5
          Re: Include Problem ?

          On Fri, 26 Oct 2007 10:47:45 +0200, Xav <xavior@inbox.c omwrote:
          I did the <pre>...</prething...
          it shows;
          >
          [0] =file1.php
          [1] =file2.php
          etc...
          >
          as expected!
          >
          I think I found a Bug!
          Not very likely.
          Do this:

          $c = count($content) ;
          for( $x=0; $x<$c; $x++ ){
          echo "|{$fileDir}{$c ontent[$x]}|\n";
          }

          The pipes are there to discover whitespace, a normal space would account
          for the difference. Normally I'd be against using <pre>, just look at the
          source. And please enable error_reporting & display_errors while
          developing, and tell us why PHP sais the include fails.
          --
          Rik Wasmus

          Comment

          Working...