/**
  * The display block Methode.
  * ShowBlock prepare the frame, header and the body of each block.
  * Load the a css file if available.
  * After frame, header and body is prepared, the block depended content output is called.
  */
 function pmxc_ShowBlock($count = 0, $placement = '')
 {
     global $options;
     if (!empty($this->inBlockCall)) {
         $this->cfg['id'] .= '_0';
     }
     // set block upshrink
     $cook = 'pmx_upshr' . $this->cfg['blocktype'] . $this->cfg['id'];
     $cookval = pmx_getcookie($cook);
     if (!empty($this->cfg['config']['collapse_state']) && is_null($cookval)) {
         $cookval = $options['collapse' . $this->cfg['blocktype'] . $this->cfg['id']] = $this->cfg['config']['collapse_state'] == '1' ? 1 : 0;
         pmx_setcookie($cook, $cookval);
     } else {
         $options['collapse' . $this->cfg['blocktype'] . $this->cfg['id']] = intval(!empty($cookval));
     }
     // Placement for Frontpage blocks?
     if (function_exists('Pmx_Frame_top') && (empty($placement) || !empty($placement) && ($placement == $this->cfg['config']['frontplace'] || empty($this->cfg['config']['frontplace'])))) {
         if ($this->cfg['blocktype'] == 'category') {
         }
         $this->getCustomCSS($this->cfg);
         Pmx_Frame_top($this->cfg, $count);
         // whe have now to call the block depended methode.
         $this->pmxc_ShowContent($count);
         Pmx_Frame_bottom();
         return 1;
     } else {
         return 0;
     }
 }
    /**
     * Write out the Sidebar
     */
    function WriteSidebar($sbCat, $subcats, $artcat, $curart)
    {
        global $txt;
        Pmx_Frame_top($sbCat, 0);
        if (!empty($curart)) {
            echo '
							<em class="pmx_emsbtop">' . $txt['pmx_more_articles'] . '</em><strong>' . strip_tags($artcat) . '</strong><hr class="pmx_hrsb" />';
            foreach ($this->articles[$this->curCat['name']] as $article) {
                $ttl = $this->getUserTitle($article);
                if (empty($ttl)) {
                    $ttl = htmlspecialchars($article['name'], ENT_QUOTES);
                }
                if ($curart == $article['name']) {
                    echo '
							<b>' . $ttl . '</b><br />';
                } else {
                    echo '
							<a href="' . $this->GetUrl((!empty($this->postarray[$this->postKey]['child']) ? 'child=' . $this->postarray[$this->postKey]['child'] . ';' : 'cat=' . $this->postarray[$this->postKey]['cat'] . ';') . 'art=' . $article['name']) . '>' . $ttl . '</a><br />';
                }
            }
        }
        if (!empty($subcats)) {
            if ($subcats[0]['name'] == $this->postarray[$this->postKey]['cat']) {
                echo '
							<em class="pmx_emsb">' . $txt['pmx_main_category'] . '</em><hr class="pmx_hrsb" />' . $subcats[0]['link'];
                unset($subcats[0]);
            }
            if (count($subcats) > 0) {
                echo '
							<em class="pmx_emsb">' . $txt['pmx_more_categories'] . '</em><hr class="pmx_hrsb" />';
            }
            foreach ($subcats as $cat) {
                echo $cat['link'];
            }
        } elseif (!empty($this->postarray[$this->postKey]['child'])) {
            $ttl = $this->getUserTitle($this->cfg);
            if (empty($ttl)) {
                $ttl = htmlspecialchars($cat['name'], ENT_QUOTES);
            }
            echo '
							<em class="pmx_emsb">' . $txt['pmx_main_category'] . '</em><hr class="pmx_hrsb" />
							<a href="' . $this->GetUrl($this->postarray[$this->postKey]['cat']) . '>' . $ttl . '</a><br />';
        }
        Pmx_Frame_bottom();
    }
 /**
  * ShowContent
  */
 function pmxc_ShowContent()
 {
     $count = count($this->articles);
     if ($this->cfg['config']['settings']['usedframe'] == 'block') {
         $count--;
     }
     foreach ($this->articles as $cnt => $article) {
         if ($this->cfg['config']['settings']['usedframe'] == 'block') {
             if (count($this->articles) > 1) {
                 $article['config']['collapse'] = 0;
                 Pmx_Frame_top($article, $count);
                 $this->WriteContent($article);
                 Pmx_Frame_bottom();
             } else {
                 $this->WriteContent($article);
             }
         } else {
             Pmx_Frame_top($article, $count);
             $this->WriteContent($article);
             Pmx_Frame_bottom();
         }
         $count--;
     }
 }