PDA

View Full Version : Trying to auto build a Foum block


MaryTheG(r)eek
07-17-2011, 04:52 PM
Hello,

I'm trying to automatically build a Forum block for one of my mods, using the code:

require_once(DIR . '/includes/class_block.php');
require_once(DIR . '/includes/functions_misc.php');
$blockmanager = vB_BlockManager::create($vbulletin);
$setting = Array();
$setting[html_type] = 'php';
$setting[html_content] = $output;
$setting[html_template] = 'block_html';
$blockmanager->saveNewBlock(1, $title, 'Classifieds', 15, $setting);


I can see the Block in the Forum Blocks, is active, all fields are correct, but the block is not appearing on the sidebar. Attached is a screenshoot from the Block Manager. Does someone knows what maybe is wrong?

Thank you
Maria

Badshah93
07-18-2011, 01:28 PM
if you have able to create block in forumblockmanager then there maybe something wrong with php code.

in php type you need to use

return $var;
to output the variable


For ex:


$templater = vB_Template::create('mytemplate');
$templater->register('myvar', $myvar);
$var = $templater->render();

return var;

MaryTheG(r)eek
07-18-2011, 01:58 PM
if you have able to create block in forumblockmanager then there maybe something wrong with php code.

I really appreciate your time to reply. I had found it already, but as I've stuck now with something similar trying to auto create CMS widget, I forgot to come to post a reply. Is exactly what you said, an error in PHP code, but it was so small that it gots me hours to find it. It was an extra > after a link.

Maria