Thanks for the swift kick in the Buttocks

Thanks to a friend giving me a swift kick in the buttocks I have started debugging the IntSmarty code for my server. Found a couple of problems. First problem I had was that my a_languages array was not being copied over to the cur_language array correctly. It seems that an empty element was also being added and of course it had to be in the first position. So made a little hack (that took longer then it should of since I was coding in java all weekend so my variables were all messed up – kept on forgetting the $) that simply loops through and finds the first non-empty element.[php]
/* hack started here */
/* to handle a_languages having empty elements in the front for no apparent reason – like mine */
$i = 0;
$isEmpty = 1;
while($isEmpty){
if (trim($this->a_languages[$i]) != ”){
$this->cur_language = $this->a_languages[$i];
$isEmpty = 0;
}
else{
$i++;
}
}
/* hack ended here *[/php]

Ok once that was fixed kept on debugging because my language table still isn’t being saved. Found out the lang_path from MyIntSmarty was being overriden by the IntSmarty lang_path. So I hard coded the path into the IntSmarty (don’t like that but can’t think of another way to do it.).

Well the language tables are finally loading… but the IntSmarty isn’t destructing and saving the table. Figure it’s because the server is running PHP4 rather then 5. Tried calling the destruct explicitly at the end of the page (after the display) and still no good. I thought about moving it to earlier in the code but then I would lose all the information for the display. Instead I called the saveLanguageTable function before all of the assignments for the display and it worked. Will try it after the assignments to see if I get the error messages.