Forum Moderators: coopster

Message Too Old, No Replies

Calling another page dynamically in php

Calling another page dynamically in php

         

Imy_S3

3:02 pm on Feb 26, 2004 (gmt 0)

10+ Year Member



Hi

I have got a if, else clause.

if(true)
{
Call n.html
}
else
{
call b.html
}

What is the syntax to call the the page in php.

Thanks in advance

bcolflesh

3:03 pm on Feb 26, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



us2.php.net/manual/en/function.include.php

jatar_k

6:14 pm on Feb 26, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



or maybe even

if(true) $page = "n";
else $page = "b";

include $page . '.html';

Just keep in mind that the include function is relative to the server's file system not the website. A file located in the root of your website can be included from anywhere in the site structure by using this

include $_SERVER [ca.php.net]['DOCUMENT_ROOT'] . $page . '.html';