Ok, here is the solution. It will be a standard implementation very soon, but you can use it already following these instructions.
Many of you probably noticed the 'Plugins' menu in dbQwikSite. None of you know that you can write your own plugins. Probably because it is not documented anywhere... yet.
Plugins are usually visible in the menus of dbQwikSite, and not only under the 'plugins' menu. You just do not know there are many features implemented as 'plugins'.
One particularity of plugins is that they can be invoked not only from menus. They can also 'subscribe' to events fired by dbQwikSite main program. Events like On Create Project, or Before/After Site generation are available for Plugins' consumption.
What I am providing here is a Plugin that subscribes to the 'After Site Generation' event. It means that once dbQwikSite has done all its work to generate all the files, the Plugin will run and do things. Things like... copying your own files or overriding generated files.How does this plugin work
We have decided that a new folder would be added to 'My Documents\My QwikSites\', called 'My Libraries'. That folder is structured like this:
In other words: \My Documents\My QwikSites\My Libraries\...
The processing of these folders is as follow:1.
dbQwikSite copies all files AND sub-folders of the '..\Global\Common
dbQwikSite copies all files AND sub-folders of the '..\Global\Asp
' folder if your target language is ASP2b.
dbQwikSite copies all files AND sub-folders of the '..\Global\Php
' folder if your target language is PHP3.
dbQwikSite copies all files AND sub-folders of the '..\[ProjectName]\Common
dbQwikSite copies all files AND sub-folders of the '..\[ProjectName]\Asp
' folder if your target language is ASP4b.
dbQwikSite copies all files AND sub-folders of the '..\[ProjectName]\Php
' folder if your target language is PHP
(It copies to your target generation folder)What does that mean
If you work on multiple projects and you have common function files, or images, or Css, or anything that you want to automatically deploy with all of your projects, they should be within the ..\Global\
If you have files that are specific to a given project, specific by language if necessary, put these files under ..\[ProjectName]\
Obviously, if you have CSS, Images, JS scripts that are only for one project, you can put them in the project itself (in ..\Projects). But you have that flexibility.
If you look into the \asp and \php folders, you will see a file called user_includes.asp or php. Use this include file to either write your own functions in it, or include other files with an include statement. The user_includes is systematically included in all generated code.
The files being copied in the above sequence is overridding whatever is on the target. So if you have a user_includes.php in the Global branch AND a user_includes.php in the Project Name branch, the later wins, overridding the file from the Global branch. dbQwikSite will not smartly 'merge' the contents of both files.
If you have a sub-folder called ..\Common\images with an image file with the same name as an image in your project folder, the file provided in the Common branch will override the one in your project. As explained before, this plugin runs 'After Site Generation', so it overules anything you have in your project.
Some people may actually be interested in this feature in particular for Database Connections. Some of you have complained that you need to use very special ADO connection strings to secured systems, bridges, whatever. You can place a 'qs_connections.xxx' in the My Libraries\[ProjectName]\Asp (or Php) and this will override what dbQwikSite generated. So if dbQwikSite does not offer you enough flexibility with database connection string builder, you are free to use your own this way.
If you look at the generated ASP or PHP pages and locate the include statements, you will see an include of qs_functions.xxx. The qs_functions.xxx is the file that itself includes the user_includes.xxx. So now you know where it is included in your pages.
This plugin applies to ALL Editions, so it is not limited to Developer Edition users!Installing the Plugin
Download this file:
My Libraries Plugin Files.rar
The rar file contains a number of files that need to be dispatched carefully. Here are the instructions:
1. Copy qs_functions.asp
to C:\Program Files\dbQwikSite 5\Data\Includes\QSLib
2. Copy QS_ApplyLibraries.plug
to C:\Program Files\dbQwikSite 5\Integration\core\utils
3. Unzip My Libraries (For Programs-Data).rar
under C:\Program Files\dbQwikSite 5\Data
(you should see 'My Libraries' under '\Data' after unzip)
4. Unzip My Libraries (For My Documents).rar
under My Documents\My QwikSites\
(you should see 'My Libraries' under '\My QwikSites' after unzip)
Restart dbQwikSite, the plugin will be loaded and active. You will not see any menu item anywhere. It is a back-end plugin only.
Should you have any error at the end of Code Generation and it cannot be resolved, rename the file QS_ApplyLibraries.plug to QS_ApplyLibraries.plug_DISABLED so it is not loaded anymore (and post your issue to this post).Final Notes
- This Plugin is provided 'as-is'. If you have problems with it you can add entries in this post. Testers are welcome to report issues here.
- Do not ask for a Plugins Developer's Guide or any documentation related to Plugins. It does not exist yet.
- Do not send technical plugins questions to the Support team, they'd probably say Plug'what?
- If you have questions about plugins in general, you can post them on this forum (as a new discussion thread please!) and I will try to find time to answer them... but you may have to wait!