Variable being redefined because of include files

Results 1 to 2 of 2

Thread: Variable being redefined because of include files

  1. #1
    Join Date
    Dec 1969

    Default Variable being redefined because of include files

    If I try to dim a variable in an include standard header file, I receieve and error about the variable being redefined. Once the base page loads, an include file is being loaded. In this file, a check is made. If true, the standard header pulls, if false, it doesnt. In the base base, the header is being pulled again. This only happens if in the include file it is not being pulled. So basically it should be only pulled once, but it seems like the include file is being pulled even if the check is true or false.<BR><BR>Does the include file always process? Is there a way to work around it?<BR><BR>Thanks<BR>

  2. #2
    SPG Guest

    Default RE: Variable being redefined because of include fi

    Yes, #include files are always #include-d. This is because they are part of an older standard set of SSI (server-side includes). It is good that they are always #include-d, as you can then use all sorts of variables and routines in them without worrying about the compilier having to re-read your code ump-teen times trying to get it all.<BR><BR>My suggestion would be to relegate the code in your #include files into either subs or functions (thus disposing of redundant global variables), #include the files at the top of your code and then call the #include-d subs/functions where your current #include statements are.<BR><BR>Hope it helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts