Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9239151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:55:15+00:00 2026-06-18T07:55:15+00:00

In php 5.3 or less it’ll provide an error like the following: Notice: Use

  • 0

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);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T07:55:16+00:00Added an answer on June 18, 2026 at 7:55 am

    Use the old trick:

    dirname(__FILE__)
    

    But if possible, update to a newer version of PHP.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to convert the following php method to use in a .less stylesheet: <?php
I am using less php and want to implement an uncompiled version of the
I am using LESS / Bootstrap on the frontend and PHP on the server-side.
I'm having some problems using strip_tags PHP function when the string contains 'less than'
I'm trying to compile LESS from PHP and don't want to use node.js or
I use PHP (lessphp) to compile LESS files into CSS files on the serverside.
I have this script in PHP // To prevent complications using scientific numbers less
I'm writing a Joomla plugin that looks more or less like: <?php // no
I use PHP to read lines by given offset (using fseek) as fseek($fp, 51);
I've the following code in PHP which works fine (returns more or less 10

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.