Forgot?

shadowbox/shadowpanel

Reply Topic
Link to this post 09 May 08

I'm trying to get the CB1.1 registration component to load in the shadowpanel module. To do this I've tried using componentbot to embed the component into a content item. I'm then using a content module with that embedded componentbot tag, inside of shadowpanel. The problem is that when the content module is displayed in the shadowpanel the componentbot mambot tag is just appearing as text rather than processing the mambot and displaying the component.
The content module works great outside of the shadowpanel.

Any ideas? or alternative approaches?

Thanks!

Link to this post 09 May 08

Hi Shinkendo,

nice ideas on usage there :)

is the componentbot a Content Mambot?

if so then this may be the reason for this, you could try change this to a system mambot on load "onAfterStart"

this should load the bot all the time, and may solve the issue, no gurantees though

Link to this post 09 May 08

RavenLife wrote:

Hi Shinkendo,

nice ideas on usage there :)

is the componentbot a Content Mambot?

if so then this may be the reason for this, you could try change this to a system mambot on load "onAfterStart"

this should load the bot all the time, and may solve the issue, no gurantees though

Thanks for the suggestion. I tried to make it a system mambot (not exactly sure how though) In the PHP and XML for the bot, I changed the references to the 'content' directory to the 'system' directory, and changed the (onContentPrep) to (onAfterStart) then reinstalled the bot. I then got lots of php errors. My inexperience in shining brightly at this point! Still not working. Did I make the correct changes below?


<?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( 'onAfterStart', '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 jos_mambots"
. "\n WHERE element = 'componentbot'"
. "\n AND folder = 'system'"
;
$database->setQuery( $query );
$database->loadObject($mambot);

$botParams = new mosParameters( $mambot->params );

	 	$height	= $botParams->def( 'height', '500' );
$width = $botParams->def( 'width', '500' );
$parentopen = $botParams->def( 'parentopen', '0' );
$url = $matches[1];
$url = 'index2.php?' . $url;
$para = 'id="componentbot" '.
'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;
}
?>

Link to this post 10 May 08

that looks correct

does it work outside of shadowpanel?

Link to this post 11 May 08

yes it works outside of shadowpanel perfectly. When I display it just as a content module it works perfectly. but when I diplay that module in shadowpanel, no joy.

Thanks for thinking about this. I'll think of a workaround in the meantime.

Cheers! PS. EXCELLENT work on these extensions. I'm impressed!

Link to this post 11 May 08

I will grab a copy of componentbot

and have a play around with it, see what i can come up with

Link to this post 11 May 08

Why not just point shadowbox at it, and use index2.php?

That will show the registration page.

Forums Joomla Extension Support Ninja Shadowbox & Ninja ShadowPanel shadowbox/shadowpanel