RE: [PHP] includes and variables

From: Date: Wed, 27 Feb 2002 00:08:05 +0000
Subject: RE: [PHP] includes and variables
Groups: php.general 
Request: Send a blank email to php-general+get-86340@lists.php.net to get a copy of this message
try changing the file table1.php to: <table> <tr> ..<td><?= $var1; ?></td> </tr> </table> -----Original Message----- From: Pax [mailto:pax@cfl.rr.com] Sent: Wednesday, February 27, 2002 11:02 AM To: php-general@lists.php.net Subject: [PHP] includes and variables Tks Martin, I guess I am doing something wrong.. I have the main document like that $var1=11; $vae2=22; $table_html= require_once("includes/table1.php"); table1.php <? <table> <tr> ..<td>$var1</td> </tr> </table> ?> I know my variables are not being parsed..plus the table definition is being placed I only want use those files for portions of html..I know it must be something simple.. Paul -----Original Message----- From: Martin Towell [mailto:martin.towell@world.net] Sent: Tuesday, February 26, 2002 5:30 PM To: 'Pax'; php-general@lists.php.net Subject: RE: [PHP] includes and variables think of an included file as if it were part of the parent code. so file1.php <? echo $foobar; ?> file2.php <? $foobar = "hello world"; include "file1.php"; ?> file2.php would basically be: <? $foobar = "hello world"; echo $foobar; ?> HTH Martin -----Original Message----- From: Pax [mailto:pax@cfl.rr.com] Sent: Wednesday, February 27, 2002 9:24 AM To: php-general@lists.php.net Subject: [PHP] includes and variables I am trying to separate html from php code. For more complicated pages I intend to generate classes..but before I start doing that is there a quick way to include html code that contains variables ? if the main page has already defined those variables, are they going to be automatically replaced? In the above situation does the file to be included needs to contain <? ?> ? Thanks Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#86340) next »