Thursday, February 25, 2010

ZedSeriesUI: how to output nice messages in your backend modules

Sometimes you need to show some messages coming from your own backend module. In these cases usage of a template would be only a waste of time.

ZedSeriesUI satisfies these needs.

With ZedSeriesUi output your message will be easily as writing these lines:

        $ui = new ZedSeriesUi();


return $ui->title('Operation completed')
.$ui->box(
$ui->beLink('Go back to the main module.', 'do=myModule&key=MyModule')
);



the result will be graphically  integrated with TYPOlight default theme:




zedseriesui_box




 




Another useful function, if you need to build a list from custom data, is the  listingContainer function that along with the listingItem, can produce output like this:




zedseriesui_listingcontainer




The above result can be produced with the following code:




 




        $ui = new ZedSeriesUi();

// just a fake data array
$items = range(1, 15);

$listingItems = array();

foreach ($items as $item) {
// collect them using listingItem
$listingItems[] = $ui->listingItem('List item #'.$item, $ui->beLink('edit', 'do=MyModule&key=MyFunction&id='.$item));
}

// then return it inside a listingContainer
return $ui->listingContainer(implode("\n", $listingItems));



ZedSeriesUI is distributed inside the ZedSeries Library extension for TYPOlight cms




ZedSeriesUI is a young project but it will grow in the next releases of ZedSeriesLibrary




Do not forget to add the proper ‘<requiredextension name=”zedseries_lib” … />’ in the package.xml of your extension




Issues of the ZedSeries Library extension are managed through bitbucket at: http://bitbucket.org/zedseries/zedseries_lib/issues/

No comments:

Post a Comment