By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,278 Members | 1,342 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,278 IT Pros & Developers. It's quick & easy.

incude in while-switch-loop

P: n/a
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_functions.php";
default:
....
break;
}

custom_functions.php:
<?
case "custom1":
...
break;
?>
But custom_functions.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
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Leif Neland" <le***@neland.dk> wrote in message
news:40*********************@dread11.news.tele.dk. ..
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_functions.php";
default:
....
break;
}

custom_functions.php:
<?
case "custom1":
...
break;
?>
But custom_functions.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.


Nope, can't be done.
Jul 17 '05 #2

P: n/a
"Leif Neland" <le***@neland.dk> wrote in message
news:40*********************@dread11.news.tele.dk. ..
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_functions.php";
default:
?>
But custom_functions.php are never included.


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

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.