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

  • SEARCH
  • Home
  • 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 6611239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:56:42+00:00 2026-05-25T19:56:42+00:00

I know I need to use spl_autoload_register with Smarty 3. I am registering my

  • 0

I know I need to use spl_autoload_register with Smarty 3. I am registering my autoload function after smarty initializes. But smarty is trying to use my own autoload function instead of the smartyAutoload defined function. Causing an error because it obviously cant find the smarty files using my autoload. Here is the code with everything else cut out to show how it is layed out currently.

I’m sure it is just an order placement issue or something.

<?php
class application {

    // include smarty
    require_once(SMARTY_DIR.'Smarty.class.php');

    // init controller class which initializes smarty
    $controller = new Controller();
}

function autoLoader($class) {

    // determine what type class it is and call from that directory
    $dir = strtolower(strstr($class, '_', true));
    $name = substr( strtolower( strstr($class, '_') ), 1 );

    switch($dir) {

        case 'component':

            break;

        default:
            require_once(LIB_PATH.DS.$name.'.class.php');
            break;

    }
}

spl_autoload_register("autoLoader");

?>
  • 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-05-25T19:56:43+00:00Added an answer on May 25, 2026 at 7:56 pm

    You can make your autoloader compatbile (that’s what spl_autoload_register is actually for) by only require a file if it’s one of your classes.

    You can do this by checking the class name against a namespace or a whitelist or with is_file (store the whitelist in the file-system):

        default:
            $path = LIB_PATH.DS.$name.'.class.php';
            if (is_file($path)) require_once($path);
            break;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to use method like: DoSomething<(T)>(); But i don't know which Type i
I know I need to use Template Columns, but I am not clearly understanding
I'm new to XSLT. I know I need to use xsl:for-each-group, but I can't
I know i need to use a list comprehension but for the life of
I know I need to use Index and Match, but these functions confuse me.
if given a graph problem how do we know whether we need to use
Somebody know how use OpenX (php app) with Django? I need to use OpenX
I'm need to use JUnit 3, I know in JUnit 4 there is a
Why does C++ need and use pointers? I know they add power to the
I need to know how to use a Dialog class in J2me. Any example.

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.