In php 5.3 or less it'll provide an error like the following:
Notice: Use of undefined constant __DIR__ - assumed '__DIR__
It's because i'm using the magic constant __DIR__
. Is there an alternative to using __DIR__
in 5.3 or less??
Here's the code that's causing it:
<?php
/**
* Load template files
*
* $files Contains alphabetized list of files that will be required
*/
$files = array(
'elements.inc',
'form.inc',
'menu.inc',
'theme.inc',
);
function _zurb_foundation_load($files) {
$tp = drupal_get_path('theme', 'zurb_foundation');
$file = '';
// Workaround for magic constant; for now because of php 5.2 issue
// http://drupal.org/node/1899620#comment-6988766
if( !defined( __DIR__ ) )define( __DIR__, dirname(__FILE__) );
// Check file path and '.inc' extension
foreach($files as $file) {
$file_path = __DIR__ .'/inc/' . $file;
if ( strpos($file,'.inc') > 0 && file_exists($file_path)) {
require_once($file_path);
}
}
}
_zurb_foundation_load($files);
Use the old trick:
dirname(__FILE__)
But if possible, update to a newer version of PHP.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With