I've heard that using the php filter is dangerous. Something about having php in databases being a bad practice. I use it in blocks quite a bit and want to move away from that.

I have a lot of page template files so I need a replacement for regions/module_invoke blocks. I tried using an include but dealing with paths was tedious. Is that the only option or is there something easier?

  • Have you looked at panels, context or display suite? All give you a rich way to determine entity inclusion, such as blocks, via a UI your advanced users can manage, without needing to know PHP. – Screenack Sep 7 '15 at 22:25
  • @Screenack I've heard of them, but I'm trying to keep using contrib modules to a minimum. – delz Sep 8 '15 at 21:02

Includes or requires is likely your best bet here, why are they tedious? If the includes are within the same theme/template files directory you needn't use absolute paths.

If you cannot use relative paths then you can use getcwd() to get the current path/working directory of a file, or use drupal_get_path() to get the path to a theme or module file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.