!Displaying your Own Table in TikiPro

!!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 TikiPro, 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 tikipro installation and make a directory:
$ mkdir newPackage
$ mkdir newPackage/modules
$ mkdir newPackage/templates

!!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
CREATE TABLE test_table
(
nameid int2 NOT NULL,
memo text[],
CONSTRAINT test_table_pkey PRIMARY KEY (nameid)
) WITHOUT OIDS;

!!3) Create your PHP file
* Go to __newPackage/__ and create a file called ''index.php''
* Add the following lines
<?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' );
?>

!!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:
<table>
{section name=colnum loop=$test_table}
<tr>
<td>{$test_table[colnum].nameid}</td>
<td>{$test_table[colnum].memo}</td>
</tr>
{/section}
</table>

!Voila!
Go to __http://yourTikiProURL/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.
$ mkdir newPackage/modules
* 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:
<table cellpadding=4 border=2>
<tr>
<td class="boxtitle"><b>Planning</b><br></td>
</tr>
<tr>
<td><a href="{$gTikiLoc.newPackage_PKG_URL/index.php">
<img src="{$gTikiLoc.IMG_PKG_URL}icons/acoolicon.gif" class="icon" alt="{tr}my new package{/tr}" title="{tr}my new package{/tr}" />My New Package</a></td>
</tr>
</table>

(:exclaim:) __$gTikiLoc.whatever_PKG_URL__ is a pointer to a folder called whatever in the root and is a very cool way of accessing icons... check out the IMG folder to fancy up your site!

Stay tune for more Tutorials!
Fire
Page History
Date/CommentUserIPVersion
14 Jan 2007 (13:14 UTC)
Add reference for testing
hiran85.233.40.19244
Current • Source
hiran85.233.40.19243
View • Compare • Difference • Source
hiran85.233.40.19242
View • Compare • Difference • Source
hiran85.233.40.19241
View • Compare • Difference • Source
hiran85.233.40.19239
View • Compare • Difference • Source
xing194.152.164.4538
View • Compare • Difference • Source
xing194.152.164.4537
View • Compare • Difference • Source
hiran85.233.40.19236
View • Compare • Difference • Source
hiran85.233.40.19234
View • Compare • Difference • Source
hiran85.233.40.19233
View • Compare • Difference • Source
hiran85.233.40.19232
View • Compare • Difference • Source
hiran85.233.40.19231
View • Compare • Difference • Source
hiran85.233.40.19230
View • Compare • Difference • Source
hiran85.233.40.19229
View • Compare • Difference • Source
hiran85.233.40.19228
View • Compare • Difference • Source
hiran85.233.40.19227
View • Compare • Difference • Source
hiran85.233.40.19226
View • Compare • Difference • Source
alexh84.112.104.14825
View • Compare • Difference • Source
johnnoone81.56.46.1524
View • Compare • Difference • Source
Sean Lee71.241.129.17423
View • Compare • Difference • Source
spiderr66.93.240.20422
View • Compare • Difference • Source
Sean Lee71.241.129.17421
View • Compare • Difference • Source
Jan Lindåker81.229.122.24919
View • Compare • Difference • Source
Simon Benedicic193.77.101.1418
View • Compare • Difference • Source
Lester Caine81.138.11.13617
View • Compare • Difference • Source
Lester Caine81.138.11.13616
View • Compare • Difference • Source