Jump to content

AtkDummyAttribute: Difference between revisions

From NusaATK
Mjs (talk | contribs)
No edit summary
Mjs (talk | contribs)
No edit summary
Line 46: Line 46:
=== See Also ===
=== See Also ===


* [[Usage without DB I/O Polymorphism]] - prevent attributes from accessing the database
* [[Usage without DB I/O Polymorphism]] - prevent an attribute from attempting to access the database; useful if you want to create a dummy "structured" attribute, such as a date attribute

Revision as of 08:57, 14 August 2008

Attribute: atkDummyAttribute

API docs | Flags

List of other attributes

atkDummyAttribute screenshot

it is possible to use this attribute among other things to give a dynamic non edit field. a none dynamic string from other attributes should use atkParserAttribute instead.

for example:

  $this->add(new atkAttribute("first_name", AF_HIDE_LIST|AF_FORCE_LOAD));
  $this->add(new atkAttribute("last_name", AF_HIDE_LIST|AF_FORCE_LOAD));
  $this->add(new atkDummyAttribute("name_citation"));

  function name_citation_display($record) 
  {
    if (strlen($record["last_name"]) <> 0) 
    {
      $string = $record["last_name"] . ", ". $record["first_name"];
    } 
    else 
    { 
      $string = $record["first_name"];
    }
  
    return $string;
  }

Note the AF_FORCE_LOAD without it the fields wont be in the returned result if AF_HIDE_LIST is used

from a table of:

John Doe
Jane

This should produce:

Doe, John

Jane

See Also

  • Usage without DB I/O Polymorphism - prevent an attribute from attempting to access the database; useful if you want to create a dummy "structured" attribute, such as a date attribute