Open Source Content Management System

PHP midgard object method set_parameter

  1. Example

Creates new or update existing parameter.

boolean set_parameter(domain, name, value);

This method takes three arguments:

  • domian, string which defines group of parameters
  • name, unique string which identifies parameters in domain
  • value, string which holds parameter's value

New parameter will be created if there's no parameter identified by name in given domain. Otherwise, existing parameter will be updated. TRUE is returned if parameter is updated or created. FALSE in other case.

Value is always string type.

Example

<?php

 try {
     $person = new midgard_person($guid);
 } catch (Exception $e) {
     echo $e->getMessage();  
 }

 if(!$person->set_parameter("im", "icq", "007"))
     echo "Could not set person's ICQ number";     


 if(!$person->set_parameter("im", "jabber", "JohnSmith"))
     echo "Could not set person's Jabber account name";     
 ?>

get_parameter and set_parameter supports persistant parameters. Database access is made only if parameter is created, deleted or changed. Multiple get_parameter invocations trigger only one select from database.

midgard object parameters

Designed by Nemein, hosted by Anykey