Freelance Developers - Read This

  • Overview

    This document is for freelancers: You've been hired to build a module for Jamroom, but have never used Jamroom before. Here are some things to help get you up to speed.
  • What are you building?

    What you are going to build is probably going to either change how something currently works or a module to output something somewhere.

    Know that where the output is destined to come out changes the correct location to build it, so you need to know the locations that exist in jamroom. They are:
    * The ACP (Admin Control Panel)
    * A Profile
    * Top level of the site

    The ACP is where the admin does all the setting configuration for the system.
    A Profile is where users upload content to.
    The top level of the site is where content is showcased, like a list of the current blogs from all the profiles.

    Jamroom uses an MVC structure, where the views of the system are structured by templates. The templates use Smarty Template Engine.
    Useful doc: Defining your own SMARTY function
    Php is used in all the modules for logic.

    Jamroom provides many custom smarty functions for skin designers to use, the most used one is {jrCore_list} which allows a database query to any module that uses a 'datastore'.
    A datastore is just a key => value data storage system that saves in a structure similar to an associative array.

  • associative array:
    array(
     'audio_title' =, "some title for this audio file",
     'audio_title_url' = "some_title_for_this_audio_file"
    // etc......
    
    );
  • A module

    Jamroom is made up of Modules and Skins, Modules are where code lives while the Skins define the layout.
    Even the core of jamroom is a module, so if you're going to add code, do it in a module.

    Do it in YOUR OWN module.

    Jamroom has a system called "Events and Listeners" which will allow you to tap into the data that is output for any other module, or over-ride that modules control and take control yourself.
    So you don't need to change the code of any existing module. Don't change the code of a module that is not yours because when the system is updated, your changes will disappear.

    There is a hello world module in github here.
    The absolute minimum that a module needs is a name and a prefix, use 'xx' if the module is not destined for inclusion in the Jamroom marketplace.
    So your module might be called:
    xxSomething

    The bare minimum it needs to get going is a _meta() function and an _init() function

  • /modules/jrHelloWorld/include.php
    <?php
    /**
     * @copyright ..........................
     * @author ........ .......... <someone [at] somewhere [dot] com>
     */
    
    
    // make sure we are not being called directly
    
    defined('APP_DIR') or exit();
    
    /**
     * meta
     */
    function jrHelloWorld_meta()
    {
        $_tmp = array(
            'name'        => 'Hello World',
            'url'         => 'hello',
            'version'     => '1.0.0',
            'developer'   => 'Sombody Somwhere, &copy;' . strftime('%Y'),
            'description' => 'print Hello World to the screen at: THIS-SITE.com/hello/world',
            'category'    => 'developer',
            'activate'    => true
        );
        return $_tmp;
    }
    
    /**
     * init
     */
    function jrHelloWorld_init()
    {
        return true;
    }
    
  • That 'url' section is the modules url, make that unique because all urls that contain that as the first parameter are coming to your module.

    site.com/hello

    Will show your modules index.tpl file if it exists
    /modules/jrHelloWorld/templates/index.tpl

    and if you want a function the second parameter looks for that function:
    site.com/hello/foo

    will fire the function:
    /modules/jrHelloWorld/index.php
    function view_jrHelloWorld_foo($_post,$_user,$_conf)
    { return 'hello world'; }

    In that function always put those args, in that order.
    * $_post // is an array that contains all the arguments coming in from the url, and $_GET and $_POST.
    * $_user // is an array that contains info on the user looking at the screen
    * $_conf // is an array that contains system configuration settings from all the modules in the system
  • Jamroom uses a routing system to channel URL's to their correct destination. Read about Jamrooms routing system here
  • Conclusion

    Its uncertain what you will be asked to build, but if you build it correctly there is a lot of demand for quality developers.

    The main discussion forums are here, ask if you need help:
    https://www.jamroom.net/the-jamroom-network/forum

    Thanks for helping our community members get what they want built.

Tags