|  | 
  John Haywood - 2009-05-17 07:25:32Really nice class, thank you!!The examples files do not work due to a typo in the main class (install.php)
 var $stages = array('stage 1','stage 2','stage 3');
 should read
 var $stages = array('stage_1','stage_2','stage_3'); (note the underscores) to ensure they match the file names built dynamically in
 function setup()
 
 I know these are merely example files but stage_1.php presentation could be vastly improved by putting the input form into a table so the input text area's line up nicely.
 
 Although this Class is for "install" ing, a lot of users would probably want to use it for updating their scripts (updating script versions) too and I think it would be a nice to to be able to specify the location of an existing file which contains DB connection information so the form (stage_1.php) could potentially be auto-populated with those fields.
 
 Thanks again for this excellent Class. I will be using it regularly.
 
  Bogdan Lupandin - 2009-05-19 02:44:33 - In reply to message 1 from John HaywoodThanks
 I fixed the typo which I must have seeing since it was fixed on my computer version... must have fixed that after uploading it here.
 
 I'm working on the enhancement idea... could you please explain what you are talking about better?
 
 Sorry, English is not my mother tongue, and I find it hard to understand it sometimes... and I'm forgetting my mother tongue as well... don't know how I will communicate later on in life lol
  Bogdan Lupandin - 2009-05-19 03:35:25 - In reply to message 1 from John Haywoodlol I just figured out what you were saying
 
 Why can't you do this?
 
 $inst->global_file = "includes/global.xml";
 <input type="text" name="host" value="<?php $inst->get_xml('host'); ?>" />
 etc; etc;
  John Haywood - 2009-05-19 08:44:47 - In reply to message 3 from Bogdan LupandinI had already modified the Class to do that but PHP beginners might not have the knowledge to work it out :)
  Bogdan Lupandin - 2009-05-21 05:29:56 - In reply to message 4 from John HaywoodIf you had to modify the class, then I must have misunderstood you... what did you do? 
  John Haywood - 2009-05-21 07:40:21 - In reply to message 5 from Bogdan LupandinMy database connection file is a PHP  file (config.php) that holds the connection variables.$dhhost , $duser etc
 So I just did
 $inst->global_file = 'config.php';
 Then I globalise the vars
 $global $dbhost, $dbuser, ... ;
 Then pass them to the form so the form is pre-populated but the user can change the values by typing in the form if they are not correct.
 
 I am using your installer when I develop plug-in modules for a CMS
  Bogdan Lupandin - 2009-05-22 05:16:17 - In reply to message 6 from John HaywoodAhh. Makes sense.
 
 Good luck... glad to hear it's working out for you :)
  Bogdan Lupandin - 2009-05-22 05:44:42 - In reply to message 6 from John HaywoodSorry, by global do you mean $GLOBAL[$user] or:
 function func_name()
 {
 global $dbname, $dbuser, $dbpass;
 // code
 }
 
 ?
  John Haywood - 2009-05-22 08:32:45 - In reply to message 8 from Bogdan LupandinSorry that was a typo for me.I just use
 global $dbhost, $dbuser etc;
 
 It is used like that throughout the content management system so that the connection details can be passed inside different functions.
 I could be wrong (I'm a beginner with PHP) but using a super global like
 $GLOBAL['dbhost'] might be a bad thing.
 
 I prefer your way of using an XML file (object) or even using a CONSTANT for db connection but I am stuck with what the CMS maker has provided.
  Bogdan Lupandin - 2009-05-23 02:11:43 - In reply to message 9 from John HaywoodNo, you're right... $GLOBALS are a security thread, and are not recommended to use.
 I'm sorry, maybe your not such a beginner in PHP as you thought, but how did you get global $dbhost, $dbuser, etc. to fill in the fields?
 
 As far as I'm aware, global $dbuser, $dbhost is good for the function it was set in and not the whole class or something else entirely...
 |