From: skaill <sk...@ro...> - 2004-09-12 20:17:25
|
What about pulling the language stuff out of session.inc and having a separate script for it. In this way language.inc can be above everything including class includes. I'm thinking if we don't do it then any class that uses strings will not be translated. Steve ----- Original Message ----- From: "Jesse Peterson" <je...@st...> To: <web...@li...> Sent: Sunday, September 12, 2004 3:39 PM Subject: Re: [Web-erp-developers] Multilanguage - includes > This is gonna be a fun one. I did the translation fixes on > ConfirmDispatch_Invoice yesterday and tried to start > ConfirmDispatchControlled_Invoice. I quickly ran into a problem that I > have finally tracked down today courtesy of var_dump. Turns out > something I knew, but neglected to think about... and web-erp is, > probably intentionally, written correctly. > > The problem is that when you use class based objects, such as cart in > DefineCartClass.php, the class needs to exist *before* the session is > started if you are going to use that object as a session variable. > Since the repercussions of it can be strange (things won't just break), > it would be a really good idea to pull all the files the order has been > changed in and fix them soon. > > That essentially puts us at needing to do something like this on every > page this happens... just in general would probably be good. > -------------------------------------------------------------------------- ---------------------------------------------- > include('includes/DefinePOClass.php'); > include('includes/DefineSerialItems.php'); > $PageSecurity = 11; > /* Session started in header.inc for password checking and authorisation > level check */ > include('includes/session.inc'); > $title = 'Receive Controlled Items'; > > include('includes/header.inc'); > -------------------------------------------------------------------------- ---------------------------------------------- > > That, however creates a smaller problem in that the strings in the > DefineXXX files can not be translated if the _() function does not > exist. I can see a few solutions: > * require_once() for the language file include, and putting that line in > session and all the files that may be included before it. (easiest) > * including all files that may be necessary in session.inc (bad idea) > * changing classes to remove strings so translation is moot (probably > more correct) > > thoughts? > > > jesse > > > skaill wrote: > > > I've noticed this type of thing in some scripts... > > > > $title = 'Receive Controlled Items'; > > $PageSecurity = 11; > > > > /* Session started in header.inc for password checking and > > authorisation level check */ > > include('includes/DefinePOClass.php'); > > include('includes/DefineSerialItems.php'); > > include('includes/session.inc'); > > include('includes/header.inc'); > > If $title was moved below session.inc and above header.inc that would > > be good for $title. However, DefineSerialItems.php has a string in it > > which means it also needs to be after session.inc. > > > > session.inc never uses any includes before it and verifies access so > > I'm thinking session.inc should always be the first include anyway. > > Can you confirm this Phil? > > > > Steve > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 > Project Admins to receive an Apple iPod Mini FREE for your judgement on > who ports your project to Linux PPC the best. Sponsored by IBM. > Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php > _______________________________________________ > Web-erp-developers mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers |