Indeed good idea, and best news is that it's already implemented experimentally (that's why it's not yet in documentation) in current CB 1.1.
As a matter of fact, a few 3pds already use this for ajax and for component-like behavior in front-end for plugins (means on a whole page, without being in a tab of user-profile).
The method is called "getTabComponent" and works by invoking:
[code:1]index.php?option=com_comprofiler&task=tabclass&tab=getyourtabclassnametab&user=63
[/code:1]
or without modules for a pop-up typically:
[code:1]index2.php?option=com_comprofiler&task=tabclass&tab=getyourtabclassnametab&user=63
[/code:1]
or for very raw outupt without html around, for images or sound, or pdf, or plain text:
[code:1]index.php?option=com_comprofiler&task=tabclass&tab=getyourtabclassnametab&user=63&no_html=1&format=raw
[/code:1]
(no_html=1 is for mambo and joomla 1.x and format=raw for 1.5).
You need to be aware that for the raw output it's very sensitive to all included php files being silent. Any error or a white-space or blank line before <?php or after ?> in a language file, a mambot, or an index.php file will be outputed (asside of killing some joomla/mambo/cb functionality since it would also not allow to output headers properly).
This is the method to add to your tab class:
[code:1] /**
* WARNING: THIS METHOD IS EXPERIMENTAL !
* WARNING: UNCHECKED ACCESS! On purpose unchecked access for M2M operations
* Generates the HTML to display for a specific component-like page for the tab. WARNING: unchecked access !
*
* @param moscomprofilerTab $tab reflecting the tab database entry
* @param mosUser $user the user being displayed
* @param int $ui 1 for front-end, 2 for back-end
* @param array $postdata _POST data for saving edited tab content as generated with getEditTab
* @return string either string HTML for tab content, or false if ErrorMSG generated
*/
function getTabComponent( &$tab, &$user, $ui, &$postdata ) {
}
[/code:1]
Please be aware that you need to implement your own access-control for this (e.g. verifying that user is logged-in if it needs to be so), as this is wide-open by default (e.g. for server-to-server communications).