How do I call an array id from another php file? Is that possible? I did the include and $array [id];
Still nothing..? I want to get id [WELCOME_INTRO] to display on another php page.
This is the array (array.php):

$ar_build = array(
		'WELCOME_INTRO' => !$VAR[4] ? get_source("".$VAR[5]."/blah.html") : get_source("".$VAR[5]."/haha.html"),
		'ADS' => html_adds(3),
		);

This is part of a phpfile (myphpfile.php)

<table style="width:100%;" cellspacing="4" cellpadding="4">
<tr>
<td style="font-size:10pt;">

<span style="vertical-align:middle;"><b>LATEST ANNOUNCEMENTS</b></span>


<div style="padding:8px;">
<div>
<?php echo $ar_build [WELCOME_INTRO]; ?>
</div>
</div>
</td>
</tr>
</table>

(I include the array.php to this php file)

All I want is the stuff on blah.html page to be written where WELCOME_INTRO is.

    <?php echo $ar_build['WELCOME_INTRO']; ?>
      laserlight wrote:
      <?php echo $ar_build['WELCOME_INTRO']; ?>

      Do I have to reference the page where the array is?

        Do I have to reference the page where the array is?

        What do you mean?

          Yes in the myphpfile.php if you want to include a variable that is declared in the array.php file then you will need to use one of these

          include( 'path to file' );
          require( 'path tofile' );
          include_once( 'PathToFile' );
          require_once( 'PathToFile' );

          Personally I only ever use the require_once as the files are needed and its safer using the _once functions that the ones without (so you don't declare functions classes etc more than once);

          This is the PHP manual for require
          http://uk.php.net/manual/en/function.require.php

          If your scroll down you'll find links to the other three

            Don't know why its not working. Did this and it's not showing anything:

            <?php
            include( '$VAR[5]/array.php' );
            
            
            
            $MAINDATA =<<<HTML
            echo $ar_build['WELCOME_INTRO'];
            HTML;
            ?>
            
              1. '$VAR[5]' results in a literal '$VAR[5]'
              2. Your use of heredoc syntax is not correct. I suggest not bothering with heredoc here.
                <?php
                include $VAR[5] . '/array.php';
                
                echo $ar_build['WELCOME_INTRO'];
                ?>

                How would I add echo $ar_build['WELCOME_INTRO']; inside the <<<HTML HTML; ?

                Did this:
                $MAINDATA =<<<HTML
                echo $ar_build['WELCOME_INTRO'];
                HTML;

                Nothing is showing. Or when I add <?php ?> inside of the html the page goes blank.

                  How would I add echo $ar_build['WELCOME_INTRO']; inside the <<<HTML HTML; ?

                  You dont. Read the PHP Manual on strings.

                    Write a Reply...