tags:

views:

342

answers:

1

I'm trying to add some sanity to the chaos that is Drupal by separating files in a fo-MVC structure. Within a Drupal view you can add Header or Footer code in textarea boxes with the option to add "PHP Code". Here is my code within the Header textarea box:

Fatal error: require_once() [function.require]: 
Failed opening required '<path_to_root>/sites/all/modules/citysensei/controllers/staff_index.php'
(include_path='.:/Applications/MAMP/bin/php5/lib/php') in <path_to_root>/includes/common.inc(1355) : 
eval()'d code on line 2

Is there a work around for this?

Thanks in advance,

Kris (quickly giving up on Drupal)

CODE:

require_once('<path_to_root>/sites/all/modules/citysensei/controllers/staff_index.php');
+1  A: 

Not sure if it will solve your particular problem or not but Drupal encourages you to use their custom include function, like this in your case:

module_load_include('php', 'citysensei', 'controllers/staff_index');

This way a user can download your module and stick it whereever they like inside a modules directory and your code will still work.

alxp

related questions