Not a developer? Go to MovableType.com

Documentation

App:Listing

This application tag is used in MT application templates to produce a table listing. It expects an object_loop variable to be available, or you can use the loop attribute to have it use a different source.

It will output it's contents once for each row of the input array. It produces markup that is compatible with the MT application templates and CSS structure, so it is not meant for general blog publishing use.

The return_args variable is recognized and will populate a hidden field in the produced form tag if available.

The blog_id variable is recognized and will populate a hidden field in the produced form tag if available.

The screen_class variable is recognized and will force the hide_pager attribute to 1 if it is set to 'search-replace'.

The magic_token variable is recognized and will populate a hidden field in the produced form tag if available (or will retrieve a token from the current application if unset).

The view_expanded variable is recognized and will affect the class name applied to the table. If assigned, the table tag will receive a 'expanded' class; otherwise, it is given a 'compact' class.

The listing_header variable is recognized and will be output in a div tag (classed with 'listing-header') that appears at the top of the listing. This is only output when 'actions' are shown (see 'show_actions' attribute).

The structure of the output from a typical use like this:

    <MTApp:Listing type="entry">
        (contents of one row for table)
    </MTApp:Listing>

produces something like this:

    <div id="entry-listing" class="listing">
        <div class="listing-header">
        </div>
        <form id="entry-listing-form" class="listing-form"
            action="..../mt.cgi" method="post"
            onsubmit="return this['__mode'] ? true : false">
            <input type="hidden" name="__mode" value="" />
            <input type="hidden" name="_type" value="entry" />
            <input type="hidden" name="action_name" value="" />
            <input type="hidden" name="itemset_action_input" value="" />
            <input type="hidden" name="return_args" value="..." />
            <input type="hidden" name="blog_id" value="1" />
            <input type="hidden" name="magic_token" value="abcd" />
            <$MTApp:ActionBar bar_position="top"
                form_id="entry-listing-form"$>
            <table id="entry-listing-table"
                class="entry-listing-table compact" cellspacing="0">

                (contents of tag are placed here)

            </table>
            <$MTApp:ActionBar bar_position="bottom"
                form_id="entry-listing-form"$>
        </form>
    </div>

Attributes:

  • type (optional)

    The MT::Object object type the listing is processing. If unset, will use the contents of the object_type variable.

  • loop (optional)

    The source of data to process. This is an array of hashes, similar to the kind used with the Loop tag. If unset, the object_loop variable is used instead.

  • empty_message (optional)

    Used when there are no rows to output for the listing. If not set, it will process any 'else' block that is available instead, or, failing that, will output an App:StatusMsg tag saying that no data could be found.

  • id (optional)

    Used to construct the DOM id for the listing. The outer div tag will use this value. If unset, it will be assigned type-listing (where 'type' is the object type determined for the listing; see 'type' attribute).

  • listing_class (optional)

    Provides a custom class name that can be applied to the main div tag produced (this is in addition to the 'listing' class that is always applied).

  • action (optional; default 'script_url' variable)

    Supplies the 'action' attribute of the form tag produced.

  • hide_pager (optional; default '0')

    Controls whether the pagination controls are shown or not. If unspecified, pagination is shown.

  • show_actions (optional; default '1')

    Controls whether the actions associated with the object type processed are shown or not. If unspecified, actions are shown.

Back

2 Comments

chiggins

chiggins on December 14, 2007, 10:26 a.m. Reply

Why is it that the form of this tag is: , while for a setting it’s ?

Mike T

Mike T on December 30, 2007, 11:02 a.m. Reply

The “empty_message” attribute must be set in order to have not problems using this tag.