Re: Require external files from module.install

Christoph Burschka <[email protected]>
Newsgroups gmane.comp.php.drupal.devel
Message-ID <[email protected]>
On 2012-03-07 10:31, Cameron B. Prince wrote:
> When the module is enabled via drush the contents of each file are printed
> to the screen

Have you made sure your included files begin with '<?php'? It sounds as
though your included code is printed instead of executed, which happens
when there are no enclosing PHP tags.

The reason you're not seeing code in the UI is that the module is
enabled (and the code is printed) while handling the form submission
(POST) which silently redirects you to the form page without displaying
any output.

A few tips aside from this:
- It sounds as though the included files directly work on a $data
variable in the file scope. It might be better to define functions in
the include files that return these arrays, and then call the functions
from module.install after including.
- Scanning a folder might not be the best approach. If the files you
need to include are always the same, then hard-coding the file names is
faster; if users can extend them, then you could provide a hook for
other modules instead of users having to copy files into this folder.

Regards,
Christoph
signature.asc (application/pgp-signature, 262 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk9XRmkACgkQhbef5VWlKioT+gCeO1sypBYgOUKC7MihjA6TVcHI
XOkAnjZJOxSA6ohjF8/G2SAwDB5q9341
=h+P8
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.