Results 1 to 8 of 8

Thread: Getting an array from an include file [Resolved]

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2004
    Posts
    21

    Getting an array from an include file [Resolved]

    Having trouble with some code... see below:

    File: template.php
    PHP Code:
    <?php /* kicks ASP! */

    $related = include('page.php');
    foreach (
    $related as $rel_item){
      include(
    $rel_item.'.php');
    }

    ?>
    File: page.php
    PHP Code:
    <?php /* kicks ASP! */

    $related = array('mediareview','vectornews','latestnews');
    return 
    $related;

    ?>
    When I access template.php I recieve the following error:
    Warning: Invalid argument supplied for foreach() in /home/xvnt/public_html/php_template/template.php on line 4
    Anybody know whats wrong?
    Thanks for any help,
    Phil

    P.S. Running PHP 4.3.8 on Apache 1.3.31, if it makes a difference.
    Last edited by ppeter; Aug 4th, 2004 at 05:47 AM.
    I am Remus, come from the dead

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width