Forums

File containing variables and functions (1 post)

  1. lelkoun
    Member
    Posted 1 year ago #

    I need to store variables and functions that are used in the main plugin's file and plugin's options file in one file for easier future editing. The problem is, that PHP does not allow it (redeclaration error). What should I do to fix it? Thanks.

    Main plugin's file:

    include("sb-common-declarations.php"); //load multiple used declarations
    
    //some code
    //...
    
    function spammer_blocker_options(){ //load options page
    
    	include("sb-common-declarations.php"); //load multiple used declarations
    
    	include("sb-options.php");
    
    }
    	add_action('admin_menu', 'spammer_blocker');

Topic Closed

This topic has been closed to new replies.

About this Topic