开发者

How / where can I include a library?

开发者 https://www.devze.com 2023-01-07 11:54 出处:网络
how can I include a custom library in Drupal ? For example I need to insert this statement somewhere, to use the dompdf library:

how can I include a custom library in Drupal ?

For example I need to insert this statement somewhere, to use the dompdf library:

require_once("dompdf_config.inc.php");

Once the this file is included, i can trigger custom php code from my drupal 开发者_如何学运维back-end custom actions.

thanks


You want to include it, in order to use it, not? If so, just include it at the place where you are going to use it. E.g. in your own dompdf.module.

. That module would then distribute the dompdf funcitonality trough your Drupal site.

Another, common route is to place the include in /sites/all/libraries/ and then to include it from your dompdf.module. libraries in /sites/all/libraries/ are often libraries that will be used in more then only your module: probably in your theme too, or in other modules too.


2 Places to do it would be

  • In a module's .module file, if you always want it included
  • Wrapped in a function that you can call, if you manually want to include it.
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号