History of Some Notes on Developing With Bitweaver
{maketoc}
!Some General Useful Stuff
----
!!Bitweaver Stuff
*__[http://www.bitweaver.org/wiki/CodingGuidelines|Bitweaver Coding Guidelines]__
*[http://81.138.11.136:8080/bitweaverdocsPHP/|Bitweaver Class Tree]
*[http://www.bitweaver.org/wiki/TP-Structures|List of BW tables and structures]
*[http://81.138.11.136:8080/bitweaverdocs//////__filesource/fsource_kernel__kernelBitDb.php.html#a498|Built-in Database Query functions available from bw kernel]
!!Programming Stuff
*((PrototypeDocumentation))
*[http://digir.sourceforge.net/nightly/DiGIRprov/lib/adodb/docs-datadict.htm|ADODB Data Dictionary for PHP]
*[http://www.howtocreate.co.uk/tutorials/index.php?tut=0&part=25|Javascript and Navigating the Dom Tree]
*[http://smarty.php.net/manual/en/language.escaping.php|Using Javascript with Smarty] and elegant solution.
*[http://en.wikipedia.org/wiki/Join_%28SQL%29|DB JOIN FAQ on Wikipedia]
*[http://rafb.net/paste/|Code Paste Board]
*[http://sunsite.mff.cuni.cz/MIRRORS/ftp.mysql.com/doc/en/CREATE_INDEX.html|Creating Indeces for your database tables] as declaired in schema_inc.php
*[http://www.bitweaver.org/wiki/ThemeTutorial#sourcecode|Modifying Smarty for Debugging HTML]
*[http://www.cs.tut.fi/%7Ejkorpela/forms/choices.html|Guide to HTML Forms]
*[http://my.opera.com/community/forums/topic.dml?id=108345|Opera 9 beta]
*[http://my.opera.com/community/customize/setups/|Opera Tools for Web Dev]
*[http://nontroppo.org/wiki/webdevtoolbar|Another Opera tool bar] and [http://nontroppo.org/wiki/MooseCSS|more]
*[http://edevil.wordpress.com/2005/11/14/javascript-libraries-roundup/|A good list of Javascript Libraries]
*[http://smarty.php.net/manual/en/api.register.function.php|Smarty Register Function Documentation] - easy steps for making custom functions that you can then call from your smarty templates.
!How to set up your own custom package
----
The easiest way to learn how to set up your own package is to start with the SamplePackage, which you can download or checkout from cvs. It has examples of most things described below.
!!Setting up your database tables
----
Database (DB) Tables are defined in __schema_inc.php__ This file goes in your __admin__ folder. Each package has one of these.
!!!Some conventions to follow when building tables:
*use single quotes on DB table scheme defaults
*underscore between each word in table names, e.g. bit_gmaps
!!Setting up Smarty templates
----
!!!Including tpl files in the html HEAD
The bitweaver Kernel is set up to automatically include header information from all packages. Any information you want included in the HTML HEAD you put in a file named __header_inc.tpl__ which goes in your package's _templates_ folder.
To create conditional header includes simply nest tpl files in the header_inc.php file. You can do this by using the this include code:
{CODE()}{ include file="bitpackage:yourpackagename/subheader.tpl"}
{CODE}
!!Setting Up Package Permissions
----
* Default permissions are set in your __schema_inc.php__ file
* Permissions can only be 30 characters long
!!Creating Package Dropdown and SidePanel Menus
----
Each package has template file for its menus. You need to explicitly declair what you want in a menu in your own template file. For an example see the wiki __package menu_wiki.tpl__ which you can find at: __/wiki/templates/menu_wiki.tpl__
!!Creating Package Preferences
----
Preferences are automatically created the first time you submit a value for one. This means that a preference can be created for the first time by simply submiting one via a form on the admin_sample.tpl. For more advanced preferences examples look at admin_wiki.tpl or admin_articles.tpl.
If you want to set default 'y' values for your package preferences during install, you declare these in the __schema_inc.php__ file in __admin__. You do not need to set a preference for any that you would give a 'n' value to.
The admin preferences panel is displayed via __/admin/admin_sample_inc.php__ usng the __template /templates/admin_sample.tpl__
Any prefereces set can be checked with __isFeatureActive()__
The admin menu is shown via __templates/menu_sample_admin.tpl__
!!Interface ( HTML ) Development
!!!Add Animated Warnings
__This explination is not perfect, and needs reworking. But it is close.__
The animated warnings you sometimes see when you tell bitweaver to do something stupid can be easily added to any page. The necessary javascript is usually added to all bitweaver pages. It comes from the file: __util/javascript/libs/fat.js__
To add an alert div you can call __kernel/smarty_bit/function.formfeedback.php__ or just include a div something like this:
{code} <div class="clear formfeedback"><ul><li id="fat4046" class="fade-000000 warning"><img src="/bw/liberty/icons/warning.png" alt="warning" title="warning" class="icon" /> This is a Warning.</li></ul></div>
{/code}
!!!Using Wiki Syntax and Parsing for HTML
Enabling Syntax support in your package is easy as is parsing it for HTML display. Nothing special needs to be done to use a particular syntax, you just insert it into your database table as is. When you want to display it in a HTML page, you parse the data using a built in parser. In your __load()__ function you include this line:
{code}$this->mInfo['parsed_data'] = $this->parseData( $this->mInfo['data'], $this->mInfo['format_guid'] );
{/code}
the first value is the raw data, and the second value is the syntax type. The site's defualt, as set in admin->liberty is used if none is specified for the individual object. Each object can have a specific syntax specified for it. Take a look at the Sample Package, and also look at the Wiki Editing html page and note the syntax options. You can find all parsers included with Bitweaver in __liberty/plugins/__; look for files like format.*.php
!!!Browser Detection
Bitweaver includes built in browser detection. Browser information is available in smarty templates via:
{code source="bash"}{$browserInfo}{/code}
Browser type is reported in:
{code source="bash"}{$browserInfo.browser}{/code}
Other properties that are avialable are:
*.ua
*.version
*.maj_ver
*.min_ver
*.letter_ver
*.javascript
*.platform
*.os
*.ip
*.cookies
*.ss_cookies
*.st_cookies
*.language
*.long_name
!General Bitweaver Information
----
!!Troublshooting Your Bitweaver Install
!!!Admin Locked Out
Try deleting your bowser cache and cookies for the site. Also try deleting from the database using the following:
{code source="sql"}DELETE FROM `tiki_preferences` WHERE name ='cookie_domain';{/code} Do the same for cookie_path.
If those don't work, then try resetting the admin password to 'foobar' using this query:
{code source="sql"}UPDATE users_users SET hash = md5( 'foobar' ) WHERE login = 'admin';{/code}
!Some General Useful Stuff
----
!!Bitweaver Stuff
*__[http://www.bitweaver.org/wiki/CodingGuidelines|Bitweaver Coding Guidelines]__
*[http://81.138.11.136:8080/bitweaverdocsPHP/|Bitweaver Class Tree]
*[http://www.bitweaver.org/wiki/TP-Structures|List of BW tables and structures]
*[http://81.138.11.136:8080/bitweaverdocs//////__filesource/fsource_kernel__kernelBitDb.php.html#a498|Built-in Database Query functions available from bw kernel]
!!Programming Stuff
*((PrototypeDocumentation))
*[http://digir.sourceforge.net/nightly/DiGIRprov/lib/adodb/docs-datadict.htm|ADODB Data Dictionary for PHP]
*[http://www.howtocreate.co.uk/tutorials/index.php?tut=0&part=25|Javascript and Navigating the Dom Tree]
*[http://smarty.php.net/manual/en/language.escaping.php|Using Javascript with Smarty] and elegant solution.
*[http://en.wikipedia.org/wiki/Join_%28SQL%29|DB JOIN FAQ on Wikipedia]
*[http://rafb.net/paste/|Code Paste Board]
*[http://sunsite.mff.cuni.cz/MIRRORS/ftp.mysql.com/doc/en/CREATE_INDEX.html|Creating Indeces for your database tables] as declaired in schema_inc.php
*[http://www.bitweaver.org/wiki/ThemeTutorial#sourcecode|Modifying Smarty for Debugging HTML]
*[http://www.cs.tut.fi/%7Ejkorpela/forms/choices.html|Guide to HTML Forms]
*[http://my.opera.com/community/forums/topic.dml?id=108345|Opera 9 beta]
*[http://my.opera.com/community/customize/setups/|Opera Tools for Web Dev]
*[http://nontroppo.org/wiki/webdevtoolbar|Another Opera tool bar] and [http://nontroppo.org/wiki/MooseCSS|more]
*[http://edevil.wordpress.com/2005/11/14/javascript-libraries-roundup/|A good list of Javascript Libraries]
*[http://smarty.php.net/manual/en/api.register.function.php|Smarty Register Function Documentation] - easy steps for making custom functions that you can then call from your smarty templates.
!How to set up your own custom package
----
The easiest way to learn how to set up your own package is to start with the SamplePackage, which you can download or checkout from cvs. It has examples of most things described below.
!!Setting up your database tables
----
Database (DB) Tables are defined in __schema_inc.php__ This file goes in your __admin__ folder. Each package has one of these.
!!!Some conventions to follow when building tables:
*use single quotes on DB table scheme defaults
*underscore between each word in table names, e.g. bit_gmaps
!!Setting up Smarty templates
----
!!!Including tpl files in the html HEAD
The bitweaver Kernel is set up to automatically include header information from all packages. Any information you want included in the HTML HEAD you put in a file named __header_inc.tpl__ which goes in your package's _templates_ folder.
To create conditional header includes simply nest tpl files in the header_inc.php file. You can do this by using the this include code:
{CODE()}{ include file="bitpackage:yourpackagename/subheader.tpl"}
{CODE}
!!Setting Up Package Permissions
----
* Default permissions are set in your __schema_inc.php__ file
* Permissions can only be 30 characters long
!!Creating Package Dropdown and SidePanel Menus
----
Each package has template file for its menus. You need to explicitly declair what you want in a menu in your own template file. For an example see the wiki __package menu_wiki.tpl__ which you can find at: __/wiki/templates/menu_wiki.tpl__
!!Creating Package Preferences
----
Preferences are automatically created the first time you submit a value for one. This means that a preference can be created for the first time by simply submiting one via a form on the admin_sample.tpl. For more advanced preferences examples look at admin_wiki.tpl or admin_articles.tpl.
If you want to set default 'y' values for your package preferences during install, you declare these in the __schema_inc.php__ file in __admin__. You do not need to set a preference for any that you would give a 'n' value to.
The admin preferences panel is displayed via __/admin/admin_sample_inc.php__ usng the __template /templates/admin_sample.tpl__
Any prefereces set can be checked with __isFeatureActive()__
The admin menu is shown via __templates/menu_sample_admin.tpl__
!!Interface ( HTML ) Development
!!!Add Animated Warnings
__This explination is not perfect, and needs reworking. But it is close.__
The animated warnings you sometimes see when you tell bitweaver to do something stupid can be easily added to any page. The necessary javascript is usually added to all bitweaver pages. It comes from the file: __util/javascript/libs/fat.js__
To add an alert div you can call __kernel/smarty_bit/function.formfeedback.php__ or just include a div something like this:
{code} <div class="clear formfeedback"><ul><li id="fat4046" class="fade-000000 warning"><img src="/bw/liberty/icons/warning.png" alt="warning" title="warning" class="icon" /> This is a Warning.</li></ul></div>
{/code}
!!!Using Wiki Syntax and Parsing for HTML
Enabling Syntax support in your package is easy as is parsing it for HTML display. Nothing special needs to be done to use a particular syntax, you just insert it into your database table as is. When you want to display it in a HTML page, you parse the data using a built in parser. In your __load()__ function you include this line:
{code}$this->mInfo['parsed_data'] = $this->parseData( $this->mInfo['data'], $this->mInfo['format_guid'] );
{/code}
the first value is the raw data, and the second value is the syntax type. The site's defualt, as set in admin->liberty is used if none is specified for the individual object. Each object can have a specific syntax specified for it. Take a look at the Sample Package, and also look at the Wiki Editing html page and note the syntax options. You can find all parsers included with Bitweaver in __liberty/plugins/__; look for files like format.*.php
!!!Browser Detection
Bitweaver includes built in browser detection. Browser information is available in smarty templates via:
{code source="bash"}{$browserInfo}{/code}
Browser type is reported in:
{code source="bash"}{$browserInfo.browser}{/code}
Other properties that are avialable are:
*.ua
*.version
*.maj_ver
*.min_ver
*.letter_ver
*.javascript
*.platform
*.os
*.ip
*.cookies
*.ss_cookies
*.st_cookies
*.language
*.long_name
!General Bitweaver Information
----
!!Troublshooting Your Bitweaver Install
!!!Admin Locked Out
Try deleting your bowser cache and cookies for the site. Also try deleting from the database using the following:
{code source="sql"}DELETE FROM `tiki_preferences` WHERE name ='cookie_domain';{/code} Do the same for cookie_path.
If those don't work, then try resetting the admin password to 'foobar' using this query:
{code source="sql"}UPDATE users_users SET hash = md5( 'foobar' ) WHERE login = 'admin';{/code}