incude in while-switch-loop

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Leif Neland

    incude in while-switch-loop

    I have a system used for multiple sites.
    Most functions are standard, but some sites have some extra functions.
    I want the extra functions in a file by itself, so the files containing the
    standard functions can be the same in all sites.

    I tried
    while (..) {
    switch ($op)
    case "std1":
    ...
    break
    case "std2":
    ...
    break
    @include "custom_functio ns.php";
    default:
    ....
    break;
    }

    custom_function s.php:
    <?
    case "custom1":
    ...
    break;
    ?>
    But custom_function s.php are never included.
    It appears that the include takes place at run-time. Is there some way to
    include at compile-time?
    Or other neat way to accomplish what I want: To have custom bits in separate
    file.

    Leif


  • Chung Leong

    #2
    Re: incude in while-switch-loop

    "Leif Neland" <leifn@neland.d k> wrote in message
    news:40ce4a62$0 $191$edfadb0f@d read11.news.tel e.dk...[color=blue]
    > I have a system used for multiple sites.
    > Most functions are standard, but some sites have some extra functions.
    > I want the extra functions in a file by itself, so the files containing[/color]
    the[color=blue]
    > standard functions can be the same in all sites.
    >
    > I tried
    > while (..) {
    > switch ($op)
    > case "std1":
    > ...
    > break
    > case "std2":
    > ...
    > break
    > @include "custom_functio ns.php";
    > default:
    > ....
    > break;
    > }
    >
    > custom_function s.php:
    > <?
    > case "custom1":
    > ...
    > break;
    > ?>
    > But custom_function s.php are never included.
    > It appears that the include takes place at run-time. Is there some way to
    > include at compile-time?
    > Or other neat way to accomplish what I want: To have custom bits in[/color]
    separate[color=blue]
    > file.[/color]

    Nope, can't be done.


    Comment

    • CJ Llewellyn

      #3
      Re: incude in while-switch-loop

      "Leif Neland" <leifn@neland.d k> wrote in message
      news:40ce4a62$0 $191$edfadb0f@d read11.news.tel e.dk...[color=blue]
      > I have a system used for multiple sites.
      > Most functions are standard, but some sites have some extra functions.
      > I want the extra functions in a file by itself, so the files containing[/color]
      the[color=blue]
      > standard functions can be the same in all sites.
      >
      > I tried
      > while (..) {
      > switch ($op)
      > case "std1":
      > ...
      > break
      > case "std2":
      > ...
      > break
      > @include "custom_functio ns.php";
      > default:
      > ?>
      > But custom_function s.php are never included.[/color]

      That's because the include statement is in a position where it will never be
      called.



      Comment

      Working...