Open Source Content Management Framework

Parameters Functions

  1. MidCOM 2.6 and upwards
    1. Getting a parameter
    2. Setting a parameter
  2. Old Midgard (< 1.8)
    1. Note

MidCOM 2.6 and upwards

MidCOM db object methods are highly recommended, instead of using $object->parameter() both as setter and getter method.

Getting a parameter

<?php
$topic = new midcom_db_topic($topic_id);
$nav_order = $topic->get_parameter('midcom.helper.nav', 'nav_order');
?>

Setting a parameter

<?php
$topic = new midcom_db_topic($topic_id);
$topic->set_parameter('midcom.helper.nav', 'nav_order', 2);
?>

Old Midgard (< 1.8)

The are no functions that manipulate the parameter objects directly. Instead, object methods are called from the object the parameter is related to. See $object->parameter and $object->listparameters.

Note also that if you have done a $obj = mgd_get_..(); function, then
you can do $parameter = $obj->domain_name to retrive the parameter value.

Note

Fetchable $object->listparameters() is not recommended, please use midcom_db objects instead whenever possible (i.e. with MidCOM 2.6 and upwards).

<?php
$article = new midcom_db_article($article_id);

// Returns an array with all the parameters, grouped by parameter
// domain and name => value pairs
$parameters = $article->list_parameters();

// Get parameters of a given domain, returns an array with
// name => value pairs
$parameters = $article->list_parameters('midcom_helper_datamanager2');
?>
Designed by Nemein, hosted by Anykey