$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

Introspecting a template

<?php
$form 
= new HTML_Template_Flexy();
$form->compile('some_file_name');
print_r($form->getElements());
?>

template example

<BODY>
  <FORM name="XXXX">
    <INPUT name="yyy">
    <SELECT name="zzz">
       <OPTION value="aaaa">AAAAA</OPTION>
    </SELECT>
  </FORM>
</BODY>

template compiled


<BODY>
  <?php echo $this->elements['XXXX']->toHtmlnoClose();?>
    <?php echo $this->elements['yyy']->toHtml();?>
    <?php echo $this->elements['zzz']->toHtml();?>
  </form>
</BODY>

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] =>
        )

)