by Spacejock Software
For Windows Vista and later (including Windows 7, 8 and 10)
yGen2 Quickstart Guide
This quick start guide was made possible thanks to donations from yGen2 users.
I'll assume you have a batch of HTML files you want to import into yGen. (The program will work with any text file, such as CSS, JS, PHP, TXT, XML, etc.)
1. Install the program
2. Click Start - All Programs - Spacejock Software - yGen2
3. When the program opens, create a new project. (File - New Project)
(I recommend creating an empty folder to hold the project.)
4. Exit yGen.
5. Copy all your source files into the Templates folder within the yGen2 project folder you created.
6. Optional - change all the extensions to .template.
Now run yGen2, and you'll see a list of all your files (minus the file extensions.)
Open the settings screen and specify the default file extension - e.g. html, htm, php, css, etc. (You can set the extension for individual files, so the default should be the one you need most often.)
As you click each file in the main list you'll note you can set the final extension in the top-right corner. E.g. enter JS (or CSS) and click Set, and the selected file will compile to (filename).js or (filename).css instead of whatever your default is.
Now, double-click one of the templates and it'll open in the yGen editor. Highlight a chunk of text which belongs together (e.g the entire HEAD section of an HTML file) and use Ctrl-X to cut. Then click the '[Inc]' button in the lower toolbar and yGen will paste in a generic include definitiion. Change the filename between the [ and ] to (eg) content_something.inc where "something" relates to the bit you cut... for example, content_header.inc.
If the include isn't displayed in red, click Update Markup to make it so.
Now double-click the red 'include' tag to open a nested editor. If it already contains text you've accidentally re-used an include from another page. DO NOT CHANGE ANYTHING - just close the editor and alter the filename before trying again. (Of course, if you knowingly reused an include then you'd expect this content to show up when you double-clicked it.) The reason you musn't change anything in an include file is because that file exists only once, even if it's included in many templates.
Assuming the editor window came up blank, just paste the code you cut out with Ctrl-V. Now click save & preview to compile the template and display it in the system default editor for the file type. E.g. if you're editing an HTML file your web browser will display the page.
You can now paste the include tag into any page which needs the same code.
If you have chunks of identical code - for example, the same header in every template file - you can now use yGen's global search/replace to switch the original code for a single include. Ensure you do the search/replace across templates, not includes. Templates are your original source files. Includes are the files containing the snippets of code.
I even use includes or variables for tags like divs, tables, etc.
There's an IncludeIf as well, which only includes the nominated file if the variable in question has been set. Click the [Inc if] button to see something like this:
(Varname just has to be set. It doesn't have to be 'true' or 'false')
Search/replace works with multiple lines of text, so you can search for a chunk of code (paste it in) and replace with the "include=" line.
You can use Variables in yGen. For example, if the header for all your pages is the same except for the title, meta tags and description, just create three variables above the spot where they're needed. (I suggest you put them at the top of the template file):
(var pagetitle=Some page title)
(var metadesc=A longer description)
(Use square brackets where I've used round ones. I can't use square or this copy of yGen I'm using will strip out the variables!)
Then, in the includes or templates, you just use the variable name (enclosed in square brackets) wherever you want the value.
You can include variable definitions in an include file, and you can nest includes to any depth.
If you redefine a variable later in the file, it will override the earlier copy.
There's a Vars dropdown in the upper toolbar which will show all the variables the current editor window knows about. Select the variable from the dropdown to insert it.
You can enter your FTP site/login details and upload one, selected, or all compiled files to a destination. If you upload Binary files from an 'Images' folder, they will also be uploaded to an 'Images' folder at the other end.
I use separate yGen projects for my website + css, my XML pad files, and other bits and pieces.
You can tell yGen to compile selected files or the entire project from the command line.
You can also upload selected files or the entire project from the command line.
This software is free to download and use, and this page explains why.