MyBB Community Forums

Full Version: How to I use ProPortal blocks on other areas of my forum?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Basically what I'm trying to do is use the ProPortal blocks in the sidebar of my index page, however I haven't been very successful with what I do know about HTML.

Could someone enlighten me on how to do this? It would be much appreciated Smile
It might not work unless you edit your index.php file as well. Its because the code/variables it is using on Portal.php page is not evaluating its templates o any other file.
(2011-05-03, 08:38 AM)Yaldaram Wrote: [ -> ]It might not work unless you edit your index.php file as well. Its because the code/variables it is using on Portal.php page is not evaluating its templates o any other file.

Thanks, not sure how to go about that however. Can you provide a guide or something to help? It would be much appreciated.
Please specify what things you want to show on index ? e.g. Latest Threads, Announcements, any thing else.
(2011-05-03, 12:27 PM)Yaldaram Wrote: [ -> ]Please specify what things you want to show on index ? e.g. Latest Threads, Announcements, any thing else.

The UserCP block and the latest threads block.
Yakdaram. Did you make any code for this?

I found this, but I did not get it to work

PHP Code:
<?php
define("IN_MYBB", 1); define("IN_PORTAL", 1);
$change_dir = "./";
$templatelist = "pro_portal,pro_portal_left,pro_portal_page,pro_portal_right,pro_portal_block,pro??_portal_announcement,calendar_mini,calendar_mini_weekrow,calendar_mini_weekrow_?d?ay,calendar_mini_weekdayheader, multipage, multipage_nextpage, multipage_page,? multipage_page_current";
require_once $change_dir."/global.php";
require_once MYBB_ROOT."portal/inc/portal.class.php";
$proportal = new ProPortal;
$lang->load("pro_portal");
$options = array(
    "order_by" => "id",
    "order_dir" => "ASC"
);
$query = $db->simple_select("portal_settings", "*", "", $options);
while($setting = $db->fetch_array($query))
{
    $setting['value'] = str_replace("\"", "\\\"", $setting['value']);
    $settings[$setting['name']] = $setting['value'];
}
$proportal->settings = &$settings;
if($proportal->settings['portalcolumns'] == "left"){ $portaltemplate = "pro_portal_left"; }
elseif($proportal->settings['portalcolumns'] == "right"){ $portaltemplate = "pro_portal_right"; }
else{ $portaltemplate = "pro_portal"; }

if($proportal->settings['portalcolumns'] == "left" || $proportal->settings['portalcolumns'] == "both")
{
    // Getting left blocks
    if ($fetch_blocks = $proportal->get_list("SELECT * FROM ".TABLE_PREFIX."portal_blocks WHERE zone='0' AND enabled='1' AND visible REGEXP '[[:<:]]".$mybb->user['usergroup']."[[:>:]]' ORDER BY position")) {
        foreach ($fetch_blocks as $result_blocks) {
            $title = $result_blocks['title'];
            $file = $result_blocks['file'];
            $content = $result_blocks['content'];
            
            // Collapse block thing
            $expdisplay = '';
            $collapsed_name = "block_{$result_blocks['id']}_c";
            if(isset($collapsed[$collapsed_name]) && $collapsed[$collapsed_name] == "display: show;")
            {
                $expcolimage = "collapse_collapsed.gif";
                $expdisplay = "display: none;";
                $expaltext = "[+]";
            }
            else
            {
                $expcolimage = "collapse.gif";
                $expaltext = "[-]";
            }
            
            if($file != "0"){
                if (file_exists(MYBB_ROOT."portal/blocks/block_$file.php")) {
                    ob_start();
                    include_once(MYBB_ROOT."portal/blocks/block_$file.php");
                    $content .= ob_get_contents();
                    ob_end_clean();
                } else {
                    $content = $lang->block_file_missing;
                }
            } else {
                $content = $result_blocks['content'];
            }
            
            if($result_blocks['custom'] == "0"){
                eval("\$leftblocks .= \"".$templates->get("pro_portal_block")."\";");
            } else {
                $leftblocks .= "<div style=\"padding-bottom:".$proportal->settings['horizontalspace']."px;\">".$content."</div>";
            }
        }
    } else {
        $title = $lang->left_block_none;
        $content = $lang->left_block_none_content;
        eval("\$leftblocks = \"".$templates->get("pro_portal_block")."\";");
    }
}

if($proportal->settings['portalcolumns'] == "right" || $proportal->settings['portalcolumns'] == "both")
{
    // Getting right blocks
    if ($fetch_blocks = $proportal->get_list("SELECT * FROM ".TABLE_PREFIX."portal_blocks WHERE zone='2' AND enabled='1' AND visible REGEXP '[[:<:]]".$mybb->user['usergroup']."[[:>:]]' ORDER BY position")) {
        foreach ($fetch_blocks as $result_blocks) {
            $title = $result_blocks['title'];
            $file = $result_blocks['file'];
            $content = $result_blocks['content'];
            
            // Collapse block thing
            $expdisplay = '';
            $collapsed_name = "block_{$result_blocks['id']}_c";
            if(isset($collapsed[$collapsed_name]) && $collapsed[$collapsed_name] == "display: show;")
            {
                $expcolimage = "collapse_collapsed.gif";
                $expdisplay = "display: none;";
                $expaltext = "[+]";
            }
            else
            {
                $expcolimage = "collapse.gif";
                $expaltext = "[-]";
            }
            
            if($file != "0"){
                if (file_exists(MYBB_ROOT."portal/blocks/block_$file.php")) {
                    ob_start();
                    include_once(MYBB_ROOT."portal/blocks/block_$file.php");
                    $content .= ob_get_contents();
                    ob_end_clean();
                } else {
                    $content = $lang->block_file_missing;
                }
            } else {
                $content = $result_blocks['content'];
            }
            
            if($result_blocks['custom'] == "0"){
                eval("\$rightblocks .= \"".$templates->get("pro_portal_block")."\";");
            } else {
                $rightblocks .= "<div style=\"padding-bottom:".$proportal->settings['horizontalspace']."px;\">".$content."</div>";
            }
        }
    } else {
        $title = $lang->right_block_none;
        $content = $lang->right_block_none_content;
        eval("\$rightblocks = \"".$templates->get("pro_portal_block")."\";");
    }
}

// edit this bit below only
        $title = "sidebars"; //page title
        eval("\$content = \"".$templates->get("sidebar_Template")."\";"); //replace templatename with your template
        add_breadcrumb("sidebars", "sidebars.php");  //custom breadcrumb and the filename of this file.
        eval("\$centerblocks .= \"".$templates->get("pro_portal_page")."\";"); //gets proportal structure
        eval("\$page = \"".$templates->get($portaltemplate)."\";"); //same as above
        output_page($page);
// end edit
?>

Did make a new one, uploaded it to root,
but I did not get it working.