This topic is locked

Master and client project practices

12/15/2015 12:06:49 AM
PHPRunner General questions
N
noozi author

I searched around the boards looking for similar situations as mine but had a hard time locating any but I am sure I am not the only one doing this.
I essentially have a master project which I use as the template for break-off projects. The master project is essentially everything I could use for any of my clients' individual sites. It includes all of the tables (MS SQL) and views and all of that. I usually make all my changes in the master project then save as for my client sites since each one uses just some of the tables and views and settings (including logos, etc.) compared to others.
Right now it is a pain to make a change to the master, save as, open the client's database, create new tables and modify fields for existing tables, etc. and then have to change logos around again, remove some views, etc.
Any recommendations for how I can do this better? I guess the key pieces for this would be creating new tables and modifying fields on the individual client databases based on the master project and changing menu page design, header images, etc. (visual aspects) for the client sites.
I feel like I may be over simplifying this a bit based on how frustrating this has been, but maybe It just seems less horrible in writing.
As a side, unrelated/related note, if I was to make a change in one of my client projects, is there any way for me to copy a view or formatting from one project to another?
Thank you in advance!

Sergey Kornilov admin 12/15/2015

While I don't know all the details of your projects it is in fact sounds like a real pain. Every time you need to propagate changes through several projects you can easily forget something.
I would suggest keeping a single project for all clients making some elements of it dynamic. For instance, you can create an additional table to store client specific settings like name of the logo file. Then instead of hardcoded image name in header file you can retrieve this file name from settings table and display it.
Again, I do not know all the details but this idea worth considering at the very least.

S
Stucco 12/15/2015

On the build screen, I put a series of other variables in the build properties, using global, which I later reference in events, exports, etc. This allows config per install on the client side, without my involvement. By doing this in connections\ConnectionManager.php, the variables automatically get into every script without editing them all, like some other external include would require.

N
noozi author 12/16/2015

Thanks for the responses Sergey and Stucco!
I spent some time yesterday thinking about the best ways to implement the listed ideas and ended up with a few more questions but I think they're easier than just the broad topic I started with.
Sergey - I would still use individual client databases, correct? I am not a huge fan of using one database for all since I would have to include a lot more data in every entry to differentiate it from others and then on features like reporting I would be concerned that they'd end up seeing everyone's data and the information is confidential. Having different databases set up, is there a way to have PHPRunner create and modify tables when I connect to a new database rather than delete the tables and fields from the project? This way I can work with my "master project" and then when it is time to deploy to each client's site, I could change the DB to theirs and have it modify the tables and fields already present.
Also, Sergey - The "settings table" makes sense as a solution to use, at least in my mind, if I have an individual database for each client. then in each deployment I assume I would use generic titles for files and text areas like "headerlogo.png" and insert those in the project where they belong and just store a different version on each database. Then do the same for text areas, etc. Does that make sense? Is that something I could do for broader settings like say, time zone settings (which I still have no idea what to do to get the times to show correctly, but that's a different topic) and pull that field into wherever I would need to to correctly adjust?
Stucco- I played around with the build screen and the options I saw there in the connection manager and think I get lost in regards to building in those properties somewhere and what those would even look like and how you differentiate clients from each other. I have gotten quite good at PHPR in general, but once I get to the coding and variables I cower away lol

Sergey Kornilov admin 12/16/2015

The best approach is to have multiple databases and single project. Connection settings like database name can be stored in external file like config.php.
Sample config.php file

<?php

$database_name="client1_database";

$database_user="xxx";

$database_pwd="xxx";

?>


Then create a new 'Server Database Connection' on 'Output directory' screen:

include("config.php");

global $database_name, $database_user, $database_pwd;

$user=$database_user;

$pwd=$database_pwd;

$sys_dbname=$database_name;


This is it. After deploying code to client's location make changes to config.php file and you are all set. Other changes can be stored in the database like name of the logo file etc.