Archived

This forum has been archived. Please start a new discussion on GitHub.

Ice_loadProfile problem

Hi and sorry for my broken English.

We are trying to translate many php classes in c++ classes with Ice framework.
We want mantain compatibility with previous php projects, using "fake" php classes, which load the Ice components transparently in behalf of interface scripts.
We don't want change a lot of code.
The problem is that each "fake" classes should call Ice_loadProfile(), because these classes could be invoked alone or in sequence.
This behaviour generates:
[error] PHP Fatal error: an Ice profile (`__default__') has already been loaded in..........
wheh we call more than one class.
The profile is always the same.

Please, could you tell me if there is a function to control if Ice_loadProfile() has already been executed?

Thanks in advance

P.S. Let us send you our compliments for the framework

Comments

  • mes
    mes California
    Hi,

    IcePHP doesn't provide a way for you to determine whether a profile has been loaded. However, I can think of a couple of ways you could handle this. First, you could set a variable that indicates you've called Ice_loadProfile (for example, you could define a utility function that checks the variable and then calls Ice_loadProfile if necessary). Second, you could use a function like class_exists() to determine whether a Slice-derived class is present, which implies that the profile has been loaded.

    Take care,
    - Mark