-First have a look at the big picture: Bitweaver uses a [http://en.wikipedia.org/wiki/Model_view_controller|Model View Controller pattern] to ease creation and maintenance of the software. The files in the sample package are the pieces glued together by the Bitweaver framework, so it is essential to understand which part is which. See also ((Model View Controller - MVC)).
+{attachment id=548 align=right} First have a look at the big picture: Bitweaver uses a [http://en.wikipedia.org/wiki/Model_view_controller|Model View Controller pattern] to ease creation and maintenance of the software. The files in the sample package are the pieces glued together by the Bitweaver framework, so it is essential to understand which part is which. See also ((Model View Controller - MVC)).
While editing Sample entries, the browser directs its requests to edit.php. Here the request data (user input) is processed and stored in the model, an instance of the BitSample class. Depending on the action requested by the user (store, load, ...) the model can be stored to the database before finally the template edit_sample.tpl is invoked which generates the HTML output. You may want to also read ((bitweaverPackage)).
-
+~clear~
Speaking more generally, we can see these types of files:
* sample/Bit*.php (Model)
+These files contain classes as container for data. As subclasses of LibertyContent they can easily be stored and loaded in the database. These classes contain your data and the code to validate, store and load themselves.
@@ -130,8 +129,8 @@
!! sample/mkpackage.sh
This script can be used to rename the sample package in order to make it easier to use it as a base for new packages. See ((SamplePackage)) for more information on using this to repackage the sample package as your own.
-!! Other optional files
-!!! Package specific Styles and Javascript
+! Other optional files
+!! Package specific Styles and Javascript
If you need some CSS to make your package 'work', you can put these into your own css in your own package. You can put this anywhere you like, such as {code}sample/styles/sample.css{/code} and then call that file from your __sample/bit_setup_inc.php__ file using: {code}$gBitThemes->loadCss( SAMPLE_PKG_PATH.'styles/sample.css' );{/code}
The same applies to javascript files you wish to add that are not present in util/javascript/ {code title="Example bit_setup_inc.php file with additional CSS and Javascript loading"}<?php
global $gBitSystem;
@@ -160,8 +159,8 @@
Using this method is the least invasive and the most flexible since it allows other developers to {code}$gBitThemes->unloadCss( SAMPLE_PKG_PATH.'styles/sample.css' );{/code} if they do not want to load the CSS file.
-!!! Header and Footer templates
-bitweaver allows you to insert code into the ~np~<head>~/np~ section without touching any files in the core. You can achieve this by adding a file called: {code}sample/templates/header_inc.tpl{/code} This file will be picked up and inserted automagically. You can test this with a simple script: {code title="Example header_inc.tpl"}{if $gBitSystem->isPackageActive( 'stars' ) and $loadStars}
+!! Header and Footer templates
+bitweaver allows you to insert code into the ~np~<head>~/np~ section without touching any files in the core. You can achieve this by adding a file called: {code}sample/templates/header_inc.tpl{/code} This file will be picked up and inserted automagically. You can test this with a simple script: {code title="Example header_inc.tpl"}{if $gBitSystem->isPackageActive( 'sample' )}
<script type="text/javascript">/* <![CDATA[ */
alert( "It's a small world, but I wouldn't want to have to paint it." );