Drupal require_once conflict
Sometimes you need to include a library that already exists and you think require_once() should solve it, but it doesn't. It will give you an Fatal error saying that you Cannot redeclare some function because its previously declared
Common libraries should not be installed in the module it should be installed in sites/all/default/libraries or something like that. But one other solution is to wrap the require_once() function with a function_exists().
<?php
function support_filter_boot(){
if (!function_exists("file_get_html")) {
require_once('simplehtmldom/simple_html_dom.php');
}
}
?>Knowledge keywords:
