RE: [PHP] includes and variables

2002-02-26 Thread Martin Towell

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:[EMAIL PROTECTED]]
Sent: Wednesday, February 27, 2002 9:24 AM
To: [EMAIL PROTECTED]
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



RE: [PHP] includes and variables

2002-02-26 Thread Martin Towell

try changing the file table1.php to:
table
tr
..td?= $var1; ?/td

/tr
/table

-Original Message-
From: Pax [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 27, 2002 11:02 AM
To: [EMAIL PROTECTED]
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:[EMAIL PROTECTED]] 
Sent: Tuesday, February 26, 2002 5:30 PM
To: 'Pax'; [EMAIL PROTECTED]
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:[EMAIL PROTECTED]]
Sent: Wednesday, February 27, 2002 9:24 AM
To: [EMAIL PROTECTED]
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