Forum Moderators: coopster

Message Too Old, No Replies

want to include a simple php statement

         

stef25

12:07 pm on Jul 9, 2004 (gmt 0)

10+ Year Member



this is a "top downloads" bar

<?php
include("dm/top.php");
?>

how would i incorporate this into an html page? ive tried just enclosing it in <div> tags but that doesnt seem to work ... i guess im seeing it too simplistically?

thanks
stef

Birdman

12:48 pm on Jul 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



stef,

Are you getting an error?

Also know that the page must be a PHP page(not HTML) for this to work, unless you make a change in your htaccess file.

Here is another way to use the include function, which uses the full server path. Alot of times it's needed.

<?php
include($_SERVER["DOCUMENT_ROOT"] . "dm/top.php");
?>

stef25

9:47 pm on Jul 9, 2004 (gmt 0)

10+ Year Member



im not getting any errors, there's just nothing showing

ive saved the file (all html) as a php file. i copy pasted the include function code you proposed.

do i need to insert my document root path? or just leave "document_root"?

i know nothing about php i guess i should start learning ...

Birdman

1:33 am on Jul 10, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi again,

sorry, I made an error in my first post. It should be:

<?php
include($_SERVER["DOCUMENT_ROOT"] . "/dm/top.php");
?>

I left a slash out :(

If that gives nothing, try this:

<?php
include($HTTP_SERVER_VARS["DOCUMENT_ROOT"] . "/dm/top.php");
?>

If that one works, your on an older version of PHP.

Birdman