Hi, I have a quick question.
I'm trying to add an include inc.php to drupal site that pulls piece of code which is just simply bunch of links to a block. But when I create block and check php, I get some crazy error "warning: include() [function.include]: URL file-access is disabled in the server configuration in /....common.inc(1645) : eval()'d code on line 1.

Does anyone know what I"m doing wrong and if there a page explaining the right way to add include to drupal block. Thank you.

Comments

Personally, I would not try

Personally, I would not try to include a file through Drupal's PHP input filter. I've never even known this to work. You could just put the code from the .inc file into the Block's source.

Carnevale Design
We make the web taste good!
http://carnevaledesign.com

Require_once

Try following one...

<?php
$path
= drupal_get_path('module', 'modulename');
require_once(
"$path/filename.inc");
?>

Adding Include To New Block

I tried different methods to add include to a new block and nothing seems to work, either an error or plain code showing up.

Does anyone know how to put include file into a new block. Include is simply a list of links that are on outside site that I want to link to. It's being linked from various other sites so I need to update it only once. I'm trying to add

<?php
include("www.site.com/inc/links.php");
?>
to a block. Why does drupal is making everything so hard. It should be simple copy, paste and update. AHHH!

I'm sure there is a really way to do it it's just I'm just learning drupal and can't figure out the way to do it. Can someone please help. Thank you in advance.

Does anyone know how to add include to the newly created block. I just need to add code, but it doesn't seem to be working.

I think Drupal re-wrote the

I think Drupal re-wrote the 'include' function to point to the /includes folder. At least for drupal 6, so if you have links.php you can put them in /include/links.php and do this:

<?php
include("links.php");
?>

It should work..

EDIT: oops there was a typo. fixed it

Thank you.

I'll give it a shot. Thank you very much for your help

doesnt work for me?

This doesn't work for me,

just prints out the php in txt

Same problem here.

I have a similar problem. I'm trying to include a custom php script that fetches the latest posts from a forum and gallery I have on my site. I only need this solution as a temporary fix until I migrate the forum and gallery to Drupal, but for now i just need to retrieve and pull the data from each of these respective programs.

If I include the scripts in the /includes folder. I will need to hunt through all the scripts and find all references and other includes and update them. At least that's my understanding, plus I don't want to add custom include files to Drupal core as this will make upgrading a pain.

Is there anyway to use an include in a custom block?

nobody click here