Drupal Theme Generator Version 2 Source Code

Drupal Theme Generator 2.2 Source Code
Version: 2.2
©2005 by Sam Raheb
Released: November 18, 2005
Designed for use with Drupal versions 4.6.x
Supports both PHPtemplate and Xtemplate Themes

A newer version is now available. Please go here

Download

This single file download is for those who already downloaded the full version which includes the sample themes. If you did not previously download the full version, then download the "Full version 2.2 Download" first (1.58 MB).

Why Release the Source Code
I have invested a good amount of time in developing a solid foundation for the program, programming it in such a way of allowing someone else to add his or her own creative enhancements to the program.

This file contains the source code for the Drupal Theme Generator. It is the same Excel (xls) file as above without the sheet protection and with all sheets visible. I am releasing the source code in the hopes that someone in the Drupal Community may be interested in building upon the Drupal Theme Generator and rereleasing it to the  Drupal Community.

Drupal Theme Generator Source Code
Most programs typically output results that are static. In the case of the Drupal Theme Generator program, the program outputs actual programming code to be used by other computers. Thus can be said the output is static but is used in a dynamic environment.

The program primarily functions by taking user input and running it through a series of IF-THEN formulas placed in strategic "line code" locations on multiple spreadsheets. The calculated result is a custom set of HTML, php, and CSS code blocks, which are then outputted as individual theme files to your local computer. These theme files are then uploaded to a web server and interpreted by the site's' theme engine to render the final theme to your web browser.

If you are familiar with writing formulas in Microsoft Excel, then this endeavor may be right for you. Keep in mind that all work preformed on this program must be open source and publicly available.

Definitions and Programming Conventions
All sheets within this source code version of the program are visible and unprotected for editing. Therefore, before you start editing this program, make sure you understand the functionality of the program.

How to view the cell formulas independent of their calculated values
Most of the formulas in the cells are IF-THEN conditional formulas. In most cases, if the value of the condition is false, then the result will be a blank value represented by double quotes "". Cells which are evaluated as "" cannot be visually seen on the spreadsheet. To toggle a view the cell formulas in all of the cells on a spreadsheet, independent of their calculated values, hold down the use the Ctrl key and press the ` key. The ` key is to the left of the #1 key.

Cell Color References for End Users
Red font colored cell are user cells. Enter your data into these cells only.
Blue and Magenta font colored cells contain formulas. Do not edit these cells.
• Black and other font colored cells are description labels.

Cell Comments
The cell comments should explain everything and include instructions on how to use the program. You should be able to view them by hovering your mouse over the cells that have a red colored triangle in the top right corner. These comments will appear as popup comic book type comments in yellow colored boxes.

Sheet Usage
A user is defined as a typical end user of the product and not a programmer who is allowed to alter the program. Certain sheets were designed to visible to the user and some not to be visible to the user. The sheets identified below as "hidden from user" are not meant to edited by the end user of the product.

    Instructions sheet (visible to user)
    This is a static sheet for displaying instructions on how to use the program.

    Settings sheet (visible to user)
    User Interface sheet that contains the initial setup parameters for the program.

    Paths sheet (hidden from user)
    Calculated file path used by the VBA macros to output the both the preview, HTML colors, and theme files.

    Design sheet (visible to user)
    User Interface sheet for design of the themes

    Database sheet (visible to user)
    Storage area containing the full list of properties for each themes. The theme name is associated with the theme file folder.

    phptemplate sheet (hidden from user)
    Contains the php code for the five (5) PHPtemplate theme files. The resulting IF-THEN conditional formulas are outputted as php files.
      • block.tpl.php
      • box.tpl.php
      • comment.tpl.php
      • node.tpl.php
      • page.tpl.php

    xtemplate.xtmpl sheet (hidden from user)
    Contains the code for the Xtemplate theme file. The resulting IF-THEN conditional formulas are outputted as the xtemplate.xtmpl file.

    style.css sheet (visible to user)
    This is the Cascading Style Sheet (CSS) code used by both the PHPtemplate and Xtemplate themes. This code is outputted as the style.css file.

    preview.html sheet (hidden from user)
    This sheet is used to provide an HTML preview of the themes using the data entered in by the user on the Design sheet. The resulting IF-THEN conditional formulas are outputted as HTML code to the preview.html file to be displayed in a web browser.

    Colors sheet (hidden from user)
    This sheet contains the HTML color codes used in the cell drop-down scroll lists appearing on the Design sheet.

    html-colors.html sheet (hidden from user)
    This sheet contains the HTML code for previewing the color. This code is outputted as the html-colors.html file.

Editing the Theme and Preview Code sheets
Each code section that will eventually be  outputted as individual files begin and end with a yellow color patterned cell. These two cells represent the beginning and end points of code sections. You can edit, delete, or add to any of the code or formulas cells between these two yellow color patterned cells. When a user presses the buttons on the Design sheet, the VBA macros output the values of the cells between the beginning and end points to files on your computer's hard drive.

Note:
Some of the code sections contain a single magenta colored font cell in the first line of the code. Do not move, edit, or delete the contents of these particular cells. The VBA macros will rewrite the contents of these cells during the outputting of the files.

VBA Macros
The VBA macros contained in this program are routines that write the calculated values of the cells to files on your computer's hard drive. The file paths and names of these files are defined on the Paths sheet. You do not need to edit the VBA macros for functionality of the program. Therefore, general access to the VBA macros is not granted and are password protected. If you really need access to the VBA macros, contact the developer Sam Raheb for the password.

Defined Names
Below is a list of the defined names use in this program. To view a list of the Defined Names in Excel, Select Excel's Insert menu then Name >> Define.

List of Defined Names used in the program

 

Design_Values

=Design!$E$12:$E$50

Path_to_block_tpl_php_file

=Paths!$C$15

Path_to_box_tpl_php_file

=Paths!$C$17

Path_to_comment_tpl_php_file

=Paths!$C$16

Path_to_html_colors_html_file

=Paths!$C$9

Path_to_node_tpl_php_file

=Paths!$C$14

Path_to_page_tpl_php_file

=Paths!$C$13

Path_to_preview_html_file

=Paths!$C$8

Path_to_style_preview_file

=Paths!$C$7

Path_to_style_theme_file

=Paths!$C$12

Path_to_xtemplate_theme_file

=Paths!$C$11

Range_HTML_color_code_code

=OFFSET('html-colors.html'!$B$2,1,0):'html-colors.html'!$B$488

Range_HTML_Colors

=Colors!$D$3:$D$440

Range_php_block.tpl.php_code

=OFFSET(phptemplate!$B$165,1,0):phptemplate!$B$199

Range_php_box.tpl.php_code

=OFFSET(phptemplate!$B$213,1,0):phptemplate!$B$218

Range_php_comment.tpl.php_code

=OFFSET(phptemplate!$B$201,1,0):phptemplate!$B$211

Range_php_node.tpl.php_code

=OFFSET(phptemplate!$B$152,1,0):phptemplate!$B$163

Range_php_page.tpl.php_code

=OFFSET(phptemplate!$B$2,1,0):phptemplate!$B$150

Range_preview_code

=OFFSET(preview.html!$B$2,1,0):preview.html!$B$570

Range_style_code

=OFFSET(style.css!$B$2,1,0):style.css!$B$440

Range_xtemplate_code

=OFFSET(xtemplate.xtmpl!$B$2,1,0):xtemplate.xtmpl!$B$256

Theme_Values

=Design!$D$12:$D$50

Themes

=OFFSET(Database!$C$2,0,1):OFFSET(Database!$C$2,0,Design!$D$5)

Software License Agreement
Distribution

This Drupal Theme Generator software is not to be sold as is or in a modified condition to any other party without permission of the developer, Sam Raheb. The term party includes individuals, groups, businesses, organizations, and educational institutions.

Software License
This is a legally binding agreement between you and Sam Raheb. By installing and / or using this software, you are agreeing to become bound by the terms of this agreement. If you do not agree to the terms of this agreement, do not use this software.

Grant of License
Sam Raheb grants to you a non-exclusive right to use this software program (hereinafter the "Software") in accordance with the terms contained in this Agreement.

Upgrades
If you acquired this Software as an upgrade of a previous version, this Agreement replaces and supercedes any prior Agreements.

Ownership of Software
Sam Raheb retains the copyright, title and ownership of the Software and the written materials.

Copies
You may make copies of the Software. You must reproduce and include the copyright notice and developers name, Sam Raheb on all copies.

Disclaimer of Warranties
Sam Raheb does not offer and disclaims all types of warranties, express or implied, including, but not limited to, any implied warranties of merchantability, fitness for a particular purpose and no infringement. Sam Raheb shall not be liable for any direct, indirect, consequential, exemplary, punitive or incidental damages arising from any cause even if Sam Raheb has been advised of the possibility of such damages.

Export Laws
You agree that you will not export the Software or documentation except in compliance with the laws and regulations of the United States.

US Government Restricted Rights
The Software and any accompanying materials are provided with Restricted Rights. Use, duplication or disclosure by the Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of The Rights in Technical Data and Computer Software clause at DFARS 252.227-7013, or subparagraphs (c)(1) and (2) of the Commercial Computer Software - Restricted Rights at 48 CFR 52.227-19, as applicable. Contractor / manufacturer is Sam Raheb.

Acknowledgments
Microsoft, Windows, Windows NT, Excel are either trademarks or registered trademarks of Microsoft Corporation in the United States and / or other countries. Microsoft Corporation's web site: http://www.microsoft.com

©2005 Sam Raheb. All rights reserved. All other trademarks and registered trademarks are the sole property of their respective owners.

I hope you enjoy this Drupal Theme Design utility. If you do, I would like to know.

Thanks,

Sam Raheb
http://xlecom.com

This software or the themes produced with this software are not to be sold without written permission of the developer, Sam Raheb.

You must login to post any comments, Thank you