GetSimple Support Forum

Full Version: Include functions.php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I noticed a problem after upgrading to 1.7 from 1.5. I removed the includes for my functions.php from the theme files and received an error stating a function used in a component could not be found. The function is in my functions.php file, which is located in my theme folder. The fix was to edit the index.php file in the webroot. I moved the check and include for the local functions.php file above where you load the theme files. Worked out fine. Anyone else seen that behavior?
So right now the functions.php file isn't being included anywhere, but it is working?
Yes, it was/is being included. The problem went away after I moved the paragraph to include the functions.php BEFORE loading the template file. My template file had a component which referenced a function in the functions.php file. When the template file processed, it gave an error that it couldn't find the function. So, I load the functions.php first, then the template.

Code:
// include the functions.php page if it exists within the theme
    if ( file_exists("theme/".$TEMPLATE."/functions.php") ) {
        include("theme/".$TEMPLATE."/functions.php");
    }
    
    // include the template and template file set within theme.php and each page
    if ( (!file_exists("theme/".$TEMPLATE."/".$template_file)) || ($template_file == '') ) { $template_file = "template.php"; }
    include("theme/".$TEMPLATE."/".$template_file);
oooohhhhhh, very good catch. I can't believe I never noticed this. I will fix it in the next release.