TheyWorkForYou

Data
in package

Data Class

Includes a metadata file that contains the actual data. It will have an array like:

$this->page = array (
    "default" => array (
        "sitetitle"    => "Haddock Directory",
        "session_vars" => array()
    ),
    "previous" => array (
        "title"   => "Previous links",
        "url"     => "previouslinks/",
        "section" => "blah"
    )
    etc...
);

And a $this->section array, although this is as yet unspecified. Something like:

$this->section = array (
    "blah" => array (
        "title" => "Blah",
        "menu"  => array (
            "text"  => "Blah",
            "title" => "Here's a link to Blah"
        )
    )
);

At some points we have a function where $type is passed in as, say, "page" and then we do:

$dataarray =& $this->$type;
return $dataarray[$item][$key];

Why? Because doing $this->$type[$item][$key] doesn't seem to work and we need to use the reference to get it working.

Tags
author

Phil Gyford phil@gyford.com

Table of Contents

Properties

$page  : mixed
$section  : mixed

Methods

__construct()  : mixed
metadata()  : mixed
Directly access an item.
page_metadata()  : mixed
Get page metadata
section_metadata()  : mixed
Get section metadata
set_page_metadata()  : mixed
Set page metadata
set_section()  : mixed
Set $this_section depending on this page's section.
set_section_metadata()  : mixed
Set section metadata
test_for_metadata()  : mixed
Test for the presence of something
getMetadata()  : mixed
setMetadata()  : mixed

Properties

$page

public mixed $page

$section

public mixed $section

Methods

__construct()

public __construct() : mixed

metadata()

Directly access an item.

public metadata(mixed $type, mixed $item, mixed $key) : mixed
Parameters
$type : mixed
$item : mixed
$key : mixed
Tags
deprecated

page_metadata()

Get page metadata

public page_metadata(string $page, string $key) : mixed
Parameters
$page : string

Page name

$key : string

The element of metadata you want to retrieve

section_metadata()

Get section metadata

public section_metadata(string $section, string $key) : mixed
Parameters
$section : string

Section name

$key : string

The element of metadata you want to retrieve

set_page_metadata()

Set page metadata

public set_page_metadata( $page,  $key,  $value) : mixed
Parameters
$page :

Page name

$key :

The element of metadata you want to set

$value :

The value to set

set_section()

Set $this_section depending on this page's section.

public set_section() : mixed

Special function for setting $this_section depending on the value of $this_page.

set_section_metadata()

Set section metadata

public set_section_metadata( $section,  $key,  $value) : mixed
Parameters
$section :

Section name

$key :

The element of metadata you want to set

$value :

The value to set

test_for_metadata()

Test for the presence of something

public test_for_metadata(mixed $type, mixed $item, mixed $key) : mixed

eg $exists = $DATA->test_for_metadata("page", "about", "title")

Parameters
$type : mixed
$item : mixed
$key : mixed

getMetadata()

private getMetadata(mixed $args, string $type) : mixed
Parameters
$args : mixed
$type : string

setMetadata()

private setMetadata(mixed $args) : mixed
Parameters
$args : mixed

        
On this page

Search results