PEAR Manual
Prev |  | Next

# $flexy->getElements()

$flexy->getElements() -- Fetch Dynamic HTML Elements from template

## Synopsis

``array $flexy-> getElements` ()`

## Description

All Form elements, FORM, INPUT, SELECT and any HTML tag that includes the attribute flexy:dynamic Is converted into HTML_Template_Flexy_Element's and stored serialized in the same folder as the Compiled flexy template.

You can use this array to make changes to these elements or find out what form elements exist on a page.

Note: you should put the modified result as the $elements argument of >outputObject(), you do not however have to fetch the elements to assign them, you can just create blank elements, and merge them.

## Return value

`array` - of Elements contained within the template. (or an empty array if no form/dynamic elements are used)

## Note

This function can not be called statically.

## Example

Example 41-1. Introspecting a template
    $form = new HTML_Template_Flexy();
    $form->compile($this->masterTemplate);
    print_r($form->getElements());

Example 41-2. template example
    <BODY>
      <FORM name="XXXX">
        <INPUT name="yyy">
        <SELECT name="zzz">
           <OPTION value="aaaa">AAAAA</OPTION>
        </SELECT>
      </FORM>
    </BODY>

Example 41-3. template compiled
    <BODY>
      <?php echo $this->elements['XXXX']->toHtmlnoClose();?>
        <?php echo $this->elements['yyy']->toHtml();?>
        <?php echo $this->elements['zzz']->toHtml();?>
      </form>
    </BODY>

Example 41-4. output from the Introspection
    Array
    (
        [XXXX] => html_template_flexy_element Object
            (
                [tag] => form
                [attributes] => Array
                    (
                        [name] => XXXX
                    )

                [children] => Array
                    (
                    )

                [override] =>
                [prefix] =>
                [suffix] =>
                [value] =>
            )

        [yyy] => html_template_flexy_element Object
            (
                [tag] => input
                [attributes] => Array
                    (
                        [name] => yyy
                    )

                [children] => Array
                    (
                    )

                [override] =>
                [prefix] =>
                [suffix] =>
                [value] =>
            )

        [zzz] => html_template_flexy_element Object
            (
                [tag] => select
                [attributes] => Array
                    (
                        [name] => zzz
                    )

                [children] => Array
                    (
                        [0] =>

                        [1] => html_template_flexy_element Object
                            (
                                [tag] => option
                                [attributes] => Array
                                    (
                                        [value] => aaaa
                                    )

                                [children] => Array
                                    (
                                        [0] => AAAAA
                                    )

                                [override] =>
                                [prefix] =>
                                [suffix] =>
                                [value] =>
                            )

                        [2] =>

                    )

                [override] =>
                [prefix] =>
                [suffix] =>
                [value] =>
            )

    )

Prev | Home | Next
$flexy->bufferedOutputObject() | Up | new HTML_Template_Flexy_Element