Tutorial_Custom_Module

Tutorials Creating Custom Packages

Created by: fire, Last modification: 08 Jun 2006 (15:28 UTC) by realname
!Creating a Custom Package in bitweaver
(WARNING - THIS TUTORIAL IS IN DEVELOPMENT - IT WILL BE FINISHED SOON!)

Introduction
Hello, my name is Fire! I am writing this tutorial to aid new developers who are interested in expanding bitweaver's features for themselves, their organization, or simply, for your own enjoyment! bitweaver is a nicely coded application, and I believe, once you complete this tutorial, you will be well on your way to develop powerful new communities for the net!

To get an understanding of bitweaver and is possibilities spiderr graciously donated some of his time on IRC, and stepped me through the process, I have extracted as much information as I could from that conversation and have listed it below - I hope you find it useful! So... without further adieu, lets work together and see what we can create!!!

Step 1: Getting the tools!


a) Downloading the CVS source
Before you can begin, you will need to download the latest code from bitweaver.org.
  • If you are using windows, there are several programs available you can use to connect to the CVS repository, the one I used was Turtoise
  • If you are using Linux, you will need to install CVS if you don't already have it.
Download bitweaver to a directory of your web server.
Once downloaded, navigate to the directory with your web browser, and follow the installation instructions, the installer is very straight forward.

Step 2: Get an IRC Program

Install an IRC Program to talk to the developers if you need help

Step 3: Lets begin!

  • Login to your bitweaver site, and go to Administration-> Custom Modules
  • Enter a name for your module
  • Now enter some HTML in the Data text field
creating a custom module
creating a custom module

  • Now press the save button
  • your custom module should now appear in the Custom Modules table
Image

  • Congrats! You just created your own custom module, now, click the Active Modules, click on the drop down box, and find your module (it will should be named: "Custom -> moduleName"
  • Select which groups will have access to the module (hold down the shift key and click to select multiple groups)
link
link

  • when you are finished, you can choose where it is displayed, the left column, or the right...
to do this, click on configure layout... I'll let you figure this one out - its pretty straight forward (:cool:) - Put it on the right for now, at position 1.

Addon - Exemple: adding rss feeds to the wiki section.

  • first create a custom module called " wikirss"
  • grab RSS 1&2 icons from google image search and copy them to your server.
  • paste this code into you module:

<?php
<a href="http://fusion.google.com/add?feedurl=http%3A//www.youBitweaver.org/wiki/wiki_rss.php%3Fversion%3D2"><img src="http://buttons.googlesyndication.com/fusion/add.gif" width="104" height="17" border="0" alt="Add to Google"></a>


<
a href="http://www.youBitweaver.org/wiki/wiki_rss.php?version=1"><img src="/themes/styles/native/images/rss1.gif" width="80" height="15" border="0" alt="RSS1"></a>


<
a href="http://www.youBitweaver.org/wiki/wiki_rss.php?version=2"><img src="/themes/styles/native/images/rss2.gif" width="80" height="15" border="0" alt="RSS2"></a>
?>

  • You can do the same with articles and so on, just change href! Note that you've got RSS1&2 and google syndication.
  • Next, you'll have to display this custom module in the wiki pages, to do so, login as admin, go to: look&feel>layout and select WIKI from the first dropdown menu.
  • then, choose your freshly created module under the module dropdown and fill in the others attributes as needed.
  • Don't forget to add also the kernel> paquage menu as adding this to wiki layout will replace the ' site defaults ' layout.
You're done!

Step 4 - The Cool Step! Displaying A Table from a Database!

Ok! Now we're gonna add a little power baby! We are going to put a link in our module, that, when pressed, displays a nice little table in the center column of bitweaver! If you complete this step, you should be on your way to make some cool new features!

  • 1) First you will need to create a table to grab data from! To do this you will need to log into your servers root. (You may need to use an SSH program. Spiderr recommended Putty - you can get it here) If you already have a table skip the table creation step.
    • I'm gonna create a table called fav_colors using postgres sql. Its gonna have the following fields: user_id, and favorite_color
    • To create the table, load up !psql from the command line:
      • psql yourdatabasename
      • type \d to display the existing tables
      • create table favorite_color(user_id int, fav_color VARCHAR(40));
      • insert into favorite_color(user_id,fav_color) VALUES (1,'blue');
  • Great! Thats it! You now have a table with some data - time to create a package and display the data in bitweaver!

2) Navigate to your the root of your bitweaver installation.
  • 2) Follow the commands below:
    • mkdir fire (replace fire with a cool package name you choose)
    • cd fire
    • mkdir fire/modules
    • cd modules
  • Now create a file called fire/modules/mod_fire.tpl, you can use pico to edit this if you like - its a nice unix file editor - simply type "pico mod_fire.tpl" in the modules directory. Any file in the modules directory named "mod_*" automatically appears in the modules list in the admin drop down menu!!!! Cool eh?
  • mod_fire.tpl is the template file we will use with all the presentation code to display your data. Later we will create mod_fire.php that has all the necessary logic to fill all the variables in the tpl file (woah... I'm getting ahead of myself!!! Lets go!
  • In mod_fire.tpl add the following code:
    • COMING SOON GUYS - I need to download the file from bonnie! Stay tuned!
  • In mod_fire.php add the following code:
    • COMING SOON GUYS - I need to download the file from bonnie! Stay tuned!

Related Items

Documentation » Tutorials

Tutorials to help you work out how something in bitweaver is done

  •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •  Anonymous  •  Array  •  Array  •  Array

Comments

Please continue your tutorial

by Wickie, 01 Jun 2004 (03:00 UTC)
(:arrow:)Please continue your tutorial