PDA

View Full Version : PHP includes in template files


era
04-23-2006, 02:38 AM
Hello,

I'm working on a mod that works on a non-PHPLD page, but I also want to embed it in my PHPLD homepage. I was wondering if I can do this. Something like -

Content visible to registered users only.

I've tried this -

{php}include("$DOCUMENT_ROOT/directory/random.php");{/php}

and it ignores it. Can I do an include in main.tpl? If so, what's the syntax?

Thanks,

Eric

anon
04-23-2006, 03:36 AM
try typing in the document root in full.

{php} include('http://www.mysite.com/directory/random.php');{/php}

era
04-23-2006, 03:44 AM
That did it.

Thanks Anon!

Eric

anon
04-23-2006, 03:55 AM
No problem. Glad I can help, and sorry that i have not been here as much lately. I've had a tremendous workload as of lately, and I am trying my best to get things finished with clients as well helping you guys out as much as possible.

Rob

Boby
04-23-2006, 04:02 PM
Content visible to registered users only.

DOCUMENT_ROOT is a constant that can be used in PHP code.
$DOCUMENT_ROOT is a Smarty template variable.

When you have PHP code in your Smarty templates you can't use Smarty template variables.

Boby