It is currently Sat May 17, 2008 7:18 pm
Moderator: General Support Moderators













<?php
/**
* @copyright Copyright (C) 2006 Kause Lotski. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*/
// no direct access
defined( '_VALID_MOS' ) or die( 'Restricted access' );
$_MAMBOTS->registerFunction( 'onPrepareContent', 'botcomponentbot' );
function botcomponentbot( $published, &$row, &$params, $page=0 ) {
// simple performance check to determine whether bot should process further
if ( strpos( $row->text, 'component' ) === false ) {
return true;
}
// define the regular expression for the bot
$regex = "#{component}(.*?){/component}#s";
// check whether mambot has been unpublished
if ( !$published ) {
$row->text = preg_replace( $regex, '', $row->text );
return true;
}
// perform the replacement
$row->text = preg_replace_callback( $regex, 'botComponentCode_replacer', $row->text );
return true;
}
/**
* Replaces the matched tags an image
* @param array An array of matches (see preg_match_all)
* @return string
*/
function botComponentCode_replacer( &$matches ) {
global $database ;
$query = "SELECT params"
. "\n FROM #__mambots"
. "\n WHERE element = 'componentbot'"
. "\n AND folder = 'content'"
;
$database->setQuery( $query );
$database->loadObject($mambot);
$botParams = new mosParameters( $mambot->params );
$height = $botParams->def( 'height', '500' );
$width = $botParams->def( 'width', '500' );
$url = $matches[1];
$url = 'index2.php?' . $url;
$para = 'id="expose" '.
'src="'.$url.'" '.
'width="'.$width.'" '.
'height="'.$height.'" '.
'frameborder="0" '.
'allowtransparency="true" '.
'scrolling="no" ';
$url = "<iframe ".$para.">\n".
"<p>Sorry, your browser cannot display frames!</p>\n".
"</iframe>\n";
return $url;
}
?>







dax702 wrote:Then you are a wonderful person! I tried it and it works! Thanks so much for developing tihis mambot!









kauselot wrote:You can change iframe size in the mabot backend settings. But of course, this "window" to your component can't be bigger than table/div that surrounds it (a recent case from another user).
Size of component that loads in the iframe is set in the component. In Expose this is done trough XML settings.






Users browsing this forum: No registered users