HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

ocPortal Developer's Guide: Zones, pages, modules, hooks and blocks

» Return to Contents


Oh crikey, all that terminology! If you don't know any of these terms, please read the glossary.

Zones are a new concept to ocPortal that make it so much more flexible than the original version. Zones are 'page spaces', that are stored in a subdirectory of the main site (or for the Welcome Zone, the main directory).
New zones may be created to wrap collections of pages for a large MOD; a good example of the use of a zone is the CEDI zone, which wraps the whole CEDI system together.

Modules and blocks will upgrade themselves if it is detected that the installed version is older than the version on-disk.
Modules and blocks all contain and info method, that returns an array of information that contains the following attributes:
  • author, the primary author of the resource
  • organisation, the primary organisation of the resource
  • version, the version number of this resource
  • hacked_by, the person who has 'hacked' (modded) this resource, or NULL if it is 'pure'
  • hack_version, the version number of the 'hack' by this 'hacker', or NULL
  • locked, true if this resource may never be uninstalled
  • update_require_upgrade, set this to anything if the resource requires upgrading from previous versions (i.e. it is not the first version, and it requires to run upgrade code to update previous versions database records)
  • hack_require_upgrade, this is equivalent to the above, but applies to the truth for the hacked version rather than the original resource

Please note that version numbers must be integers. i.e. The sequence must only involve whole numbers (1,2,3,4…)

You may create a 'minimodule' instead of a full module, and just echo out your output. Most developers will find this preferable. The same goes for a miniblock instead of a block.

sources/zones.php

Global_functions_zones.php

Function summary

void init__zones ()
PATH zone_black_magic_filterer (PATH path, boolean relative)
ID_TEXT get_zone_name ()
?ID_TEXT get_module_zone (ID_TEXT module_name, ID_TEXT type, ?string dir2, string ftype, boolean error)
?ID_TEXT get_comcode_zone (ID_TEXT page_name, boolean error)
?ID_TEXT get_page_zone (ID_TEXT page_name, boolean error)
tempcode load_minimodule_page (PATH string)
tempcode load_module_page (PATH string, ID_TEXT codename)
array find_all_zones (boolean search, boolean get_titles, boolean force_all, integer start, integer max)
void cache_module_installed_status ()
boolean module_installed (ID_TEXT module)
PATH _get_module_path (ID_TEXT zone, ID_TEXT module)
array find_all_hooks (ID_TEXT type, ID_TEXT entry)
tempcode do_block (ID_TEXT codename, ?array map, ?integer ttl)
string block_params_arr_to_str (array map)
mixed do_block_hunt_file (ID_TEXT codename, ?array map)
?LONG_TEXT do_block_get_cache_identifier (mixed cache_on, ?array map)
PATH _get_block_path (ID_TEXT block)
boolean block_installed (ID_TEXT block)
array find_all_pages_wrap (ID_TEXT zone, boolean keep_ext_on, boolean consider_redirects, integer show_method, ?ID_TEXT page_type)
array find_all_pages (ID_TEXT zone, ID_TEXT type, string ext, boolean keep_ext_on, ?TIME cutoff_time, integer show_method)
array find_all_modules (ID_TEXT zone)
array extract_module_functions (PATH path, array functions, ?array params)

void init__zones()

Standard code module initialisation function.

Parameters…

(No return value)


Return to the function index for this class Expand: View the source code to this function

PATH zone_black_magic_filterer(PATH path, boolean relative)

Consider virtual zone merging, where paths are not necessarily where you'd expect for pages in zones.

Parameters…

Name path
Description The path, assuming in the obvious place.
Type PATH

Name relative
Description Where the passed path is relative.
Default value boolean-false
Type boolean

Returns…

Description The fixed path.
Type PATH

Return to the function index for this class Expand: View the source code to this function

ID_TEXT get_zone_name()

Get the name of the zone the current page request is coming from.

Parameters…

Returns…

Description The current zone
Type ID_TEXT

Return to the function index for this class Expand: View the source code to this function

?ID_TEXT get_module_zone(ID_TEXT module_name, ID_TEXT type, ?string dir2, string ftype, boolean error)

Find the zone a page is in.

Parameters…

Name module_name
Description The page name to find
Type ID_TEXT

Name type
Description The type of the page we are looking for
Default value modules
Type ID_TEXT

Name dir2
Description The special subcategorisation of page we are looking for (e.g. 'EN' for a comcode page) (NULL: none)
Default value
Type ?string

Name ftype
Description The file extension for the page type
Default value php
Type string

Name error
Description Whether ocPortal should bomb out if the page was not found
Default value boolean-true
Type boolean

Returns…

Description The zone the page is in (NULL: not found)
Type ?ID_TEXT

Return to the function index for this class Expand: View the source code to this function

?ID_TEXT get_comcode_zone(ID_TEXT page_name, boolean error)

Find the zone a comcode page is in.

Parameters…

Name page_name
Description The comcode page name to find
Type ID_TEXT

Name error
Description Whether ocPortal should bomb out if the page was not found
Default value boolean-true
Type boolean

Returns…

Description The zone the comcode page is in (NULL: missing)
Type ?ID_TEXT

Return to the function index for this class Expand: View the source code to this function

?ID_TEXT get_page_zone(ID_TEXT page_name, boolean error)

Find the zone a page is in.

Parameters…

Name page_name
Description The page name to find
Type ID_TEXT

Name error
Description Whether ocPortal should bomb out if the page was not found
Default value boolean-true
Type boolean

Returns…

Description The zone the page is in (NULL: missing)
Type ?ID_TEXT

Return to the function index for this class Expand: View the source code to this function

tempcode load_minimodule_page(PATH string)

Runs the specified mini-module.The module result is returned.

Parameters…

Name string
Description The relative path to the module file
Type PATH

Returns…

Description The result of executing the module
Type tempcode

Return to the function index for this class Expand: View the source code to this function

tempcode load_module_page(PATH string, ID_TEXT codename)

Runs the specified module, but also update any stats for the module, and check to see if it needs upgrading or reinstalling.The module result is returned.

Parameters…

Name string
Description The relative path to the module file
Type PATH

Name codename
Description The page name to load
Type ID_TEXT

Returns…

Description The result of executing the module
Type tempcode

Return to the function index for this class Expand: View the source code to this function

array find_all_zones(boolean search, boolean get_titles, boolean force_all, integer start, integer max)

Find the installed zones, up to the first $max installed

Parameters…

Name search
Description Whether to search the file system and return zones that might not be fully in the system (otherwise will just use the database)
Default value boolean-false
Type boolean

Name get_titles
Description Whether to get titles for the zones as well. Only if !$search
Default value boolean-false
Type boolean

Name force_all
Description Whether to insist on getting all zones (there could be thousands in theory...)
Default value boolean-false
Type boolean

Name start
Description Start position to get results from
Default value 0
Type integer

Name max
Description Maximum zones to get
Default value 50
Type integer

Returns…

Description A list of zone names / a list of quartets (name, title, show in menu, default page)
Type array

Return to the function index for this class Expand: View the source code to this function

void cache_module_installed_status()

Look up and remember what modules are installed.

Parameters…

(No return value)


Return to the function index for this class Expand: View the source code to this function

boolean module_installed(ID_TEXT module)

Check to see if a module is installed.

Parameters…

Name module
Description The module name
Type ID_TEXT

Returns…

Description Whether it is
Type boolean

Return to the function index for this class Expand: View the source code to this function

PATH _get_module_path(ID_TEXT zone, ID_TEXT module)

Get the path to a module known to be in a certain zone.

Parameters…

Name zone
Description The zone name
Type ID_TEXT

Name module
Description The module name
Type ID_TEXT

Returns…

Description The module path
Type PATH

Return to the function index for this class Expand: View the source code to this function

array find_all_hooks(ID_TEXT type, ID_TEXT entry)

Get an array of all the hook implementations for a hook class.

Parameters…

Name type
Description The type of hook
Type ID_TEXT
Values restricted to blocks modules systems

Name entry
Description The hook class to find hook implementations for (e.g. the name of a module)
Type ID_TEXT

Returns…

Description A map of hook implementation name to [sources|sources_custom]
Type array

Return to the function index for this class Expand: View the source code to this function

tempcode do_block(ID_TEXT codename, ?array map, ?integer ttl)

Get the processed tempcode for the specified block. Please note that you pass multiple parameters in as an array, but single parameters go in as a string or other flat variable.

Parameters…

Name codename
Description The block name
Type ID_TEXT

Name map
Description The block parameter map (NULL: no parameters)
Default value
Type ?array

Name ttl
Description The TTL to use in minutes (NULL: block default)
Default value
Type ?integer

Returns…

Description The generated tempcode
Type tempcode

Return to the function index for this class Expand: View the source code to this function

string block_params_arr_to_str(array map)

Convert a parameter set from a an array (for PHP code) to a string (for templates).

Parameters…

Name map
Description The parameters / acceptable parameter pattern
Type array

Returns…

Description The parameters / acceptable parameter pattern, as template safe parameter
Type string

Return to the function index for this class Expand: View the source code to this function

mixed do_block_hunt_file(ID_TEXT codename, ?array map)

Get the block object for a given block codename.

Parameters…

Name codename
Description The block name
Type ID_TEXT

Name map
Description The block parameter map (NULL: no parameters)
Default value
Type ?array

Returns…

Description Either the block object, or the string output of a miniblock
Type mixed

Return to the function index for this class Expand: View the source code to this function

?LONG_TEXT do_block_get_cache_identifier(mixed cache_on, ?array map)

Takes a string which is a PHP expression over $map (parameter map), and returns a derived identifier.We see if we have something cached by looking for a matching identifier.

Parameters…

Name cache_on
Description PHP expression over $map (the parameter map of the block) OR a call_user_func specifier that will return a result (which will be used if cacheing is really very important, even for Hip Hop PHP)
Type mixed

Name map
Description The block parameter map (NULL: no parameters)
Type ?array

Returns…

Description The derived cache identifier (NULL: the identifier is CURRENTLY null meaning cannot be cached)
Type ?LONG_TEXT

Return to the function index for this class Expand: View the source code to this function

PATH _get_block_path(ID_TEXT block)

Gets the path to a block code file for a block code name

Parameters…

Name block
Description The name of the block
Type ID_TEXT

Returns…

Description The path to the block
Type PATH

Return to the function index for this class Expand: View the source code to this function

boolean block_installed(ID_TEXT block)

Check to see if a block is installed.

Parameters…

Name block
Description The module name
Type ID_TEXT

Returns…

Description Whether it is
Type boolean

Return to the function index for this class Expand: View the source code to this function

array find_all_pages_wrap(ID_TEXT zone, boolean keep_ext_on, boolean consider_redirects, integer show_method, ?ID_TEXT page_type)

Get an array of all the pages everywhere in the zone, limited by the selection algorithm (for small sites everything will be returned, for larger ones it depends on the show method).

Parameters…

Name zone
Description The zone name
Type ID_TEXT

Name keep_ext_on
Description Whether to leave file extensions on the page name
Default value boolean-false
Type boolean

Name consider_redirects
Description Whether to take redirects into account
Default value boolean-false
Type boolean

Name show_method
Description Selection algorithm constant
Default value 0
Type integer
Values restricted to 0 1 2

Name page_type
Description Page type to show (NULL: all)
Default value
Type ?ID_TEXT

Returns…

Description A map of page name to type (modules_custom, etc)
Type array

Return to the function index for this class Expand: View the source code to this function

array find_all_pages(ID_TEXT zone, ID_TEXT type, string ext, boolean keep_ext_on, ?TIME cutoff_time, integer show_method)

Get an array of all the pages of the specified type (module, etc) and extension (for small sites everything will be returned, for larger ones it depends on the show method).

Parameters…

Name zone
Description The zone name
Type ID_TEXT

Name type
Description The type
Type ID_TEXT
Values restricted to modules modules_custom comcode comcode_custom html html_custom

Name ext
Description The file extension to limit us to (without a dot)
Default value php
Type string

Name keep_ext_on
Description Whether to leave file extensions on the page name
Default value boolean-false
Type boolean

Name cutoff_time
Description Only show pages newer than (NULL: no restriction)
Default value
Type ?TIME

Name show_method
Description Selection algorithm constant
Default value 0
Type integer
Values restricted to 0 1 2

Returns…

Description A map of page name to type (modules_custom, etc)
Type array

Return to the function index for this class Expand: View the source code to this function

array find_all_modules(ID_TEXT zone)

Get an array of all the modules.

Parameters…

Name zone
Description The zone name
Type ID_TEXT

Returns…

Description A map of page name to type (modules_custom, etc)
Type array

Return to the function index for this class Expand: View the source code to this function

array extract_module_functions(PATH path, array functions, ?array params)

Extract code to execute the requested functions with the requested parameters from the module at the given path.We used to actually load up the module, but it ate all our RAM when we did!

Parameters…

Name path
Description The path to the module
Type PATH

Name functions
Description Array of functions to be executing
Type array

Name params
Description A list of parameters to pass to our functions (NULL: none)
Default value
Type ?array

Returns…

Description A list of pieces of code to do the equivalent of executing the requested functions with the requested parameters
Type array

Return to the function index for this class Expand: View the source code to this function

sources/zones2.php

Global_functions_zones2.php

Function summary

void init__zones2 ()
void actual_add_zone (ID_TEXT zone, SHORT_TEXT title, ID_TEXT default_page, SHORT_TEXT header_text, ID_TEXT theme, BINARY wide, BINARY require_session, BINARY displayed_in_menu)
array get_module_overridables (ID_TEXT zone, ID_TEXT page)
integer upgrade_module (ID_TEXT zone, ID_TEXT module)
boolean reinstall_module (ID_TEXT zone, ID_TEXT module)
void uninstall_module (ID_TEXT zone, ID_TEXT module)
array find_all_blocks ()
string cleanup_block_name (ID_TEXT block)
array get_block_parameters (ID_TEXT block)
integer upgrade_block (ID_TEXT block)
boolean reinstall_block (ID_TEXT block)
void uninstall_block (ID_TEXT block)
array extract_module_functions_page (ID_TEXT zone, ID_TEXT page, array functions, ?array params)
?array extract_module_info (PATH path)
array _find_all_pages_wrap (ID_TEXT zone, boolean keep_ext_on, boolean consider_redirects, integer show_method, ?ID_TEXT page_type)
array _find_all_pages (ID_TEXT zone, ID_TEXT type, string ext, boolean keep_ext_on, ?TIME cutoff_time, integer show_method, ?boolean custom)
array _find_all_modules (ID_TEXT zone)

void init__zones2()

Standard code module initialisation function.

Parameters…

(No return value)


Return to the function index for this class Expand: View the source code to this function

void actual_add_zone(ID_TEXT zone, SHORT_TEXT title, ID_TEXT default_page, SHORT_TEXT header_text, ID_TEXT theme, BINARY wide, BINARY require_session, BINARY displayed_in_menu)

Add a zone.

Parameters…

Name zone
Description Name of the zone
Type ID_TEXT

Name title
Description The zone title
Type SHORT_TEXT

Name default_page
Description The zones default page
Default value start
Type ID_TEXT

Name header_text
Description The header text
Default value
Type SHORT_TEXT

Name theme
Description The theme
Default value default
Type ID_TEXT

Name wide
Description Whether the zone is wide
Default value 0
Type BINARY

Name require_session
Description Whether the zone requires a session for pages to be used
Default value 0
Type BINARY

Name displayed_in_menu
Description Whether the zone in displayed in the menu coded into some themes
Default value 1
Type BINARY

(No return value)


Return to the function index for this class Expand: View the source code to this function

array get_module_overridables(ID_TEXT zone, ID_TEXT page)

Get a list of overridable SP's for a module.

Parameters…

Name zone
Description The zone it is in
Type ID_TEXT

Name page
Description The page name
Type ID_TEXT

Returns…

Description A pair: List of overridable SP's, SP-page
Type array

Return to the function index for this class Expand: View the source code to this function

integer upgrade_module(ID_TEXT zone, ID_TEXT module)

Upgrade the specified module.

Parameters…

Name zone
Description The zone name
Type ID_TEXT

Name module
Description The module name
Type ID_TEXT

Returns…

Description 0=No upgrade. -2=Not installed, 1=Upgrade
Type integer

Return to the function index for this class Expand: View the source code to this function

boolean reinstall_module(ID_TEXT zone, ID_TEXT module)

Reinstall the specified module.

Parameters…

Name zone
Description The zone name
Type ID_TEXT

Name module
Description The module name
Type ID_TEXT

Returns…

Description Whether a module installer had to be run
Type boolean

Return to the function index for this class Expand: View the source code to this function

void uninstall_module(ID_TEXT zone, ID_TEXT module)

Completely uninstall the specified module from the system.

Parameters…

Name zone
Description The zone name
Type ID_TEXT

Name module
Description The module name
Type ID_TEXT

(No return value)


Return to the function index for this class Expand: View the source code to this function

array find_all_blocks()

Get an array of all the blocks that are currently installed (miniblocks not included).

Parameters…

Returns…

Description Map of all blocks (name->[sources/sources_custom])
Type array

Return to the function index for this class Expand: View the source code to this function

string cleanup_block_name(ID_TEXT block)

Make a block codename look nice

Parameters…

Name block
Description The raw block codename
Type ID_TEXT

Returns…

Description A nice human readable version of the name
Type string

Return to the function index for this class Expand: View the source code to this function

array get_block_parameters(ID_TEXT block)

Gets parameters for a block

Parameters…

Name block
Description The name of the block to get parameters for
Type ID_TEXT

Returns…

Description A list of parameters the block takes
Type array

Return to the function index for this class Expand: View the source code to this function

integer upgrade_block(ID_TEXT block)

Upgrades a block to the latest version available on your ocPortal installation. This function can only upgrade to the latest version put into the block directory. You should not need to use this function.

Parameters…

Name block
Description The name of the block to upgrade
Type ID_TEXT

Returns…

Description 0=No upgrade. -2=Not installed, 1=Upgrade
Type integer

Return to the function index for this class Expand: View the source code to this function

boolean reinstall_block(ID_TEXT block)

Reinstall a block if it has become corrupted for any reason.Again, you should not need to use this function.

Parameters…

Name block
Description The name of the block to reinstall
Type ID_TEXT

Returns…

Description Whether installation was required
Type boolean

Return to the function index for this class Expand: View the source code to this function

void uninstall_block(ID_TEXT block)

This function totally uninstalls a block from the system. Yet again, you should not need to use this function.

Parameters…

Name block
Description The name of the block to uninstall
Type ID_TEXT

(No return value)


Return to the function index for this class Expand: View the source code to this function

array extract_module_functions_page(ID_TEXT zone, ID_TEXT page, array functions, ?array params)

Extract code to execute the requested functions with the requested parameters from the module requested.

Parameters…

Name zone
Description The zone it is in
Type ID_TEXT

Name page
Description The page name
Type ID_TEXT

Name functions
Description Array of functions to be executing
Type array

Name params
Description A list of parameters to pass to our functions (NULL: none)
Default value
Type ?array

Returns…

Description A list of pieces of code to do the equivalent of executing the requested functions with the requested parameters
Type array

Return to the function index for this class Expand: View the source code to this function

?array extract_module_info(PATH path)

Extract the info function from a module at a given path.

Parameters…

Name path
Description The path to the module
Type PATH

Returns…

Description A module information map (NULL: module contains no info method)
Type ?array

Return to the function index for this class Expand: View the source code to this function

array _find_all_pages_wrap(ID_TEXT zone, boolean keep_ext_on, boolean consider_redirects, integer show_method, ?ID_TEXT page_type)

Get an array of all the pages everywhere in the zone (for small sites everything will be returned, for larger ones it depends on the show method).

Parameters…

Name zone
Description The zone name
Type ID_TEXT

Name keep_ext_on
Description Whether to leave file extensions on the page name
Default value boolean-false
Type boolean

Name consider_redirects
Description Whether to take redirects into account
Default value boolean-false
Type boolean

Name show_method
Description Selection algorithm constant
Default value 0
Type integer
Values restricted to 0 1 2

Name page_type
Description Page type to show (NULL: all)
Default value
Type ?ID_TEXT

Returns…

Description A map of page name to type (modules_custom, etc)
Type array

Return to the function index for this class Expand: View the source code to this function

array _find_all_pages(ID_TEXT zone, ID_TEXT type, string ext, boolean keep_ext_on, ?TIME cutoff_time, integer show_method, ?boolean custom)

Get an array of all the pages of the specified type (module, etc) and extension (for small sites everything will be returned, for larger ones it depends on the show method).

Parameters…

Name zone
Description The zone name
Type ID_TEXT

Name type
Description The type (including language, if appropriate)
Type ID_TEXT
Values restricted to modules modules_custom comcode/EN comcode_custom/EN html/EN html_custom/EN

Name ext
Description The file extension to limit us to (without a dot)
Default value php
Type string

Name keep_ext_on
Description Whether to leave file extensions on the page name
Default value boolean-false
Type boolean

Name cutoff_time
Description Only show pages newer than (NULL: no restriction)
Default value
Type ?TIME

Name show_method
Description Selection algorithm constant
Default value 0
Type integer
Values restricted to 0 1 2

Name custom
Description Whether to search under the custom-file-base (NULL: auto-decide)
Default value
Type ?boolean

Returns…

Description A map of page name to type (modules_custom, etc)
Type array

Return to the function index for this class Expand: View the source code to this function

array _find_all_modules(ID_TEXT zone)

Get an array of all the modules.

Parameters…

Name zone
Description The zone name
Type ID_TEXT

Returns…

Description A map of page name to type (modules_custom, etc)
Type array

Return to the function index for this class Expand: View the source code to this function

Hooks are special objects that exist for modules or blocks that use them. They define modular functionality that the block or module can call upon, in order to extend it's influence to uncoupled concepts. For example, the stats block uses hooks for each type of stats in order to avoid putting a burden on that block knowing about all types of content (and thus being highly contested over by modders wanting to add stuff). By using hooks, modularity can be maintained and functionality extended by addition of hooks, not modification of existing code.

Hooks are used for the following in ocPortal, in a default installation:
  • point-store frontends
  • cache rebuilders
  • importers
  • content search handlers
  • unvalidated handlers
  • newsletter what's new handlers
  • side stats
  • staff checklist

Tutorial - Module Basics


This tutorial will show you the basics of creating a module, and making it automatically install and uninstall itself.

1) Create a blank PHP file in root/pages/modules/, call it 'teapot.php'

2) Insert the following code:

Code (php)

<?php /*

Put your copyright notice in here.

*/

class Module_teapot
{

function info()
{
   $info['author']='Bob';
   $info['organisation']='Bobsoft';
   $info['hacked_by']=NULL;
   $info['hack_version']=NULL;
   $info['version']=1;
        $info['locked']=false;
        //If locked is true, this module cannot be uninstalled as other modules use its functionality
   return $info;
}

function uninstall()
{
        //Uninstall code goes here
}

function install($upgrade_from=NULL, $upgrade_from_hack=NULL)
{      
        //Install code goes here
}

function run()
{
   // What action are we going to do?
   $type=get_param("type","");
       
        //This is for the lang used below
        //This is normally where you would add required languages and code
        require_lang('comcode');

   if ($type=="foo") return $this->foo();
   return $this->interface();
}

function foo()
{
        You would put some sort of action code in here, such as adding a teapot
}

function interface()
{
        $title=get_page_title('REFERENCE_SOURCE');

        //Here is some completely random code to display a results field, and show you how to as well
        //You really should get strings from the language INI files using do_lang, but that is beyond the scope of this tutorial
        $fields_title=results_field_title(array('Name','Address','Age'));
        $url=build_url(array("page"=>"teapot"));
        $fields = blank_tempcode();
        $values = array('Bobby','Fred','Shower Cap');
        $values2 = array('James','House','Ducky');
        foreach($values as $i=>$value)
        {
                $fields->attach(results_entry(array(hyperlink($url, $value), $values2[$i], $value)));
        }
        //Of course, $fields will not be blank, but I might as well show you a nice error trapper...
        if ($fields->is_blank()) return message_page($title,do_lang("NO_ENTRIES"));

        $output = results_table(0,'start',3,'max', $fields_title, $fields,false);
       
        return do_template('INDEX_PAGE',array('PRE'=>'','POST'=>'','TITLE'=>$title,'CONTENT'=>$output));
}

}

?>

Explanation:

The module is wrapped in a class starting with 'Module_', then the name of the file (without the '.php' extension).
The info function is called to provide information to admins about this module. You have to have an info function.
The install function is called on installation to install the module. You would place code to add permissions, config options, and do database operations such as adding tables in this function.
The uninstall function is obviously called to uninstall the module. You should remove ALL traces of your module in this function.
The run function is called when someone requests a page from this module. You have to have this function. Generally, it is used as a 'contents' page - it looks at the GET variables, and decides what the user wants to do. It then executes the associated function, which outputs whatever it need to, to the browser.
The build_url function call returns a complete URL, taking an array of required GET variables as input.
Here you can see how to use tempcode: Initialize a tempcode variable, then add stuff to it using ->attach

3) Add your own code as required.



Blocks are small, reusable sections of code that can be placed anywhere in the website. They are supported by comcode, using the 'block' tag, and can be seen everywhere on a default installation of ocPortal. Things such as the Image Of The Day (IOTD), and the RSS feed on the main page are all blocks.
Blocks are referenced by codename, and filenames and function names are based on that codename.
By convention, a block is either a main block or a side block, but ocPortal defines no strict mechanism for dealing with this.

Tutorial - Displaying a Block



To display a block, you need a block, and some code to display it with. The block needs to work. Here is the PHP code to display the block:

Code (php)

$output->attach(do_block('main_rss', $rss_feed_url));

Alternatively, you could achieve the same end in comcode:

Code

[html][block="http://slashdot.org/index.rss"]main_rss[/block][/html]