History of Tutorial_Custom_Package
{maketoc}
!Displaying your Own Table in bitweaver
!!Introduction
This is a BASIC tutorial that will show you how to make a quick package that loops through a table and displays its data. I wrote this because I am starting from the VERY beginning here in bitweaver, and want to make tutorials as I go to help new opensource developers who are joining the project and need a booster seat to sit at the table! I hope it is useful to you!
Thanks for your help Spiderr
!!1) Create a New Package
* Go to the root of your bitweaver installation and make a directory:
{CODE()}$ mkdir newPackage
$ mkdir newPackage/modules
$ mkdir newPackage/templates{CODE}
!!2) Create your table
* Using PostgreSQL, and a neat utility like [http://www.pgadmin.org/pgadmin3/index.php|pgAdmin3] create a database called ''test_table'', and add two colums: ''nameid'', and ''memo'', or use the sql below
{CODE()}CREATE TABLE test_table
(
nameid int2 NOT NULL,
memo text[],
CONSTRAINT test_table_pkey PRIMARY KEY (nameid)
) WITHOUT OIDS;{CODE}
!!3) Create your PHP file
* Go to __newPackage/__ and create a file called ''index.php''
* Add the following lines
{CODE()}<?php
require_once('../tiki_setup_inc.php'); //initialized the entire system!
$result = $gTikiSystem->query("SELECT * FROM test_table");
$smarty->assign('test_table', $result->GetArray());
$gTikiSystem->display( 'tikipackage:newPackage/newPackage.tpl' );
?>{CODE}
!!4) Create your Smarty TPL file
* Now go to __newPackage/templates__ and create a file using pico, or whatever you use, called ''newPackage.tpl''
* Add these lines:
{CODE()}<table>
{section name=colnum loop=$test_table}
<tr>
<td>{$test_table[colnum].nameid}</td>
<td>{$test_table[colnum].memo}</td>
</tr>
{/section}
</table>{CODE}
!Voila!
Go to __http://yourbitweaverURL/newPackage/__ and your table should be displayed!
!!5) Now, create a Module
* Create a module (a little box that you can display in the left or right columns) with a pointer to your awesome new package.
{CODE()}$ mkdir newPackage/modules{CODE}
* and create a file using pico, or whatever you use, called ''mod_newPackage.tpl''.
* The file name must be formated like this so the tikisystem can include it in the __Administration / Modules__ dropdown list.
* Add these lines to the file:
{CODE()}<table>
<tr>
<td class="boxtitle"><b>Planning</b><br></td>
</tr>
<tr>
<td><a href="{$gTikiLoc.newPackage_PKG_URL/index.php">
{tikicon ipackage=newPackage iname=iconname iexplain="this is a cool icon"}My New Package</a></td>
</tr>
</table>{CODE}
(:exclaim:) __$gTikiLoc.whatever_PKG_URL__ is a pointer to a folder called whatever in the root...
to use icons check out our cool new icon system called ((function_tikicon|tikicon))
!!6)List of available constants in bitweaver
-=automagically generated constants for each package of the form=-
<PACKAGE>_PKG_PATH --> example: WIKI_PKG_PATH
this will give you the full path to the wiki folder
<PACKAGE>_PKG_URL --> example: WIKI_PKG_URL
this will give you the full url to the wiki folder
-=in addition there are a few more=-
these contain the full path and url to the root of the application
TIKI_ROOT_PATH
TIKI_ROOT_URL
contains the name of the currently active package
ACTIVE_PACKAGE
full path and url to the currently active style
THEMES_STYLE_PATH
THEMES_STYLE_URL
Stay tuned for more Tutorials!
Fire
!Displaying your Own Table in bitweaver
!!Introduction
This is a BASIC tutorial that will show you how to make a quick package that loops through a table and displays its data. I wrote this because I am starting from the VERY beginning here in bitweaver, and want to make tutorials as I go to help new opensource developers who are joining the project and need a booster seat to sit at the table! I hope it is useful to you!
Thanks for your help Spiderr
!!1) Create a New Package
* Go to the root of your bitweaver installation and make a directory:
{CODE()}$ mkdir newPackage
$ mkdir newPackage/modules
$ mkdir newPackage/templates{CODE}
!!2) Create your table
* Using PostgreSQL, and a neat utility like [http://www.pgadmin.org/pgadmin3/index.php|pgAdmin3] create a database called ''test_table'', and add two colums: ''nameid'', and ''memo'', or use the sql below
{CODE()}CREATE TABLE test_table
(
nameid int2 NOT NULL,
memo text[],
CONSTRAINT test_table_pkey PRIMARY KEY (nameid)
) WITHOUT OIDS;{CODE}
!!3) Create your PHP file
* Go to __newPackage/__ and create a file called ''index.php''
* Add the following lines
{CODE()}<?php
require_once('../tiki_setup_inc.php'); //initialized the entire system!
$result = $gTikiSystem->query("SELECT * FROM test_table");
$smarty->assign('test_table', $result->GetArray());
$gTikiSystem->display( 'tikipackage:newPackage/newPackage.tpl' );
?>{CODE}
!!4) Create your Smarty TPL file
* Now go to __newPackage/templates__ and create a file using pico, or whatever you use, called ''newPackage.tpl''
* Add these lines:
{CODE()}<table>
{section name=colnum loop=$test_table}
<tr>
<td>{$test_table[colnum].nameid}</td>
<td>{$test_table[colnum].memo}</td>
</tr>
{/section}
</table>{CODE}
!Voila!
Go to __http://yourbitweaverURL/newPackage/__ and your table should be displayed!
!!5) Now, create a Module
* Create a module (a little box that you can display in the left or right columns) with a pointer to your awesome new package.
{CODE()}$ mkdir newPackage/modules{CODE}
* and create a file using pico, or whatever you use, called ''mod_newPackage.tpl''.
* The file name must be formated like this so the tikisystem can include it in the __Administration / Modules__ dropdown list.
* Add these lines to the file:
{CODE()}<table>
<tr>
<td class="boxtitle"><b>Planning</b><br></td>
</tr>
<tr>
<td><a href="{$gTikiLoc.newPackage_PKG_URL/index.php">
{tikicon ipackage=newPackage iname=iconname iexplain="this is a cool icon"}My New Package</a></td>
</tr>
</table>{CODE}
(:exclaim:) __$gTikiLoc.whatever_PKG_URL__ is a pointer to a folder called whatever in the root...
to use icons check out our cool new icon system called ((function_tikicon|tikicon))
!!6)List of available constants in bitweaver
-=automagically generated constants for each package of the form=-
<PACKAGE>_PKG_PATH --> example: WIKI_PKG_PATH
this will give you the full path to the wiki folder
<PACKAGE>_PKG_URL --> example: WIKI_PKG_URL
this will give you the full url to the wiki folder
-=in addition there are a few more=-
these contain the full path and url to the root of the application
TIKI_ROOT_PATH
TIKI_ROOT_URL
contains the name of the currently active package
ACTIVE_PACKAGE
full path and url to the currently active style
THEMES_STYLE_PATH
THEMES_STYLE_URL
Stay tuned for more Tutorials!
Fire