mikeoffy69 Posted January 11, 2010 Share Posted January 11, 2010 So i have been pulling my hair out trying to get a 4th column added to my knowledge base. I am using inter-spire knowledge base software and have the developers version but i have it installed internal and not live on the web. So i will do my best to explain. If you look at the picture you will see what I want. I would like to add a 4th column to the main categories section. I am pretty sure I am editing the correct code. This is called the CategoriesPanel.php. Here is the code if anyone can see where i would need to change to add a 4th column. I have messed with the $count over and over and can see the amount of categories change but its usual's not what i want. <?php CLASS AKB_CATEGORIES_PANEL extends AKB_PANEL { /** * SetPanelSettings * This function is a chance to set any last minute global variables for * the template to use * * @return void */ function SetPanelSettings() { $GLOBALS['Categories'] = $this->GetCategoryTable(); if ($GLOBALS['cleanUrls'] === true) { $arrURI = explode('/', $_SERVER['REQUEST_URI']); $todo = $arrURI[sizeof($arrURI)-1]; } else if (isset($_GET['todo'])) { $todo = $_GET['todo']; } else { $todo = ''; } switch ($todo) { case '__addarticle': $GLOBALS['AddArticle'] = '1'; break; } } /** * GetCategoryTable * Get an html table of categories for displaying to the user * * @return string the html to display */ function GetCategoryTable() { if (isset($GLOBALS['CategoryId'])) { $catid = (int) $GLOBALS['CategoryId']; } else { $catid = 0; } $output = ''; $count = 0; $GLOBALS['AKB_CLASS_HELPER']->getCatsInfo(); if (isset($GLOBALS['categoryRestrictOption']) && $GLOBALS['categoryRestrictOption'] == "1") { $accessible_cats = $GLOBALS['AKB_CLASS_HELPER']->GetPermittedCats(); } else { $accessible_cats = false; } if (isset($GLOBALS['AKB_CLASS_HELPER']->tree->nodesByPid[$catid]) && is_array($GLOBALS['AKB_CLASS_HELPER']->tree->nodesByPid[$catid]) && !empty($GLOBALS['AKB_CLASS_HELPER']->tree->nodesByPid[$catid])) { // Return a 3xn table of categories ordered by name $output = $GLOBALS['AKB_CLASS_TEMPLATE']->GetSnippet('CategoryGridHeader'); foreach ($GLOBALS['AKB_CLASS_HELPER']->tree->nodesByPid[$catid] as $rowid) { $row = $GLOBALS['AKB_CLASS_HELPER']->catsById[$rowid]; if (($accessible_cats !== false) && (!in_array($row['categoryid'],$accessible_cats)) && ($row['security'] == "private")) { continue; } $children = $GLOBALS['AKB_CLASS_HELPER']->GetNumQuestionsInCategory($row['categoryid']); // Every 3rd category print start a new row if ($count % CATEGORIES_PER_ROW == 0) { $output .= $GLOBALS['AKB_CLASS_TEMPLATE']->GetSnippet('CategoryRowHeader'); } $GLOBALS['Icon'] = $GLOBALS['AKB_CLASS_TEMPLATE']->DisablePlaceholders($row['icon']); $GLOBALS['Description'] = strip_tags($row['description'],"<a>"); $GLOBALS['Link'] = GetUrl('category', $row['categoryid']); $GLOBALS['Text'] = htmlspecialchars($GLOBALS['AKB_CLASS_TEMPLATE']->DisablePlaceholders($row['name']),ENT_QUOTES,$GLOBALS['charset']); $GLOBALS['QuestionCount'] = $children; $output .= $GLOBALS['AKB_CLASS_TEMPLATE']->GetSnippet('CategoryRowCell'); // Every 3rd category end a row if ($count % CATEGORIES_PER_ROW == CATEGORIES_PER_ROW - 1) { $output .= $GLOBALS['AKB_CLASS_TEMPLATE']->GetSnippet('CategoryRowFooter'); } $count++; } if ($count % CATEGORIES_PER_ROW != CATEGORIES_PER_ROW) { $output .= $GLOBALS['AKB_CLASS_TEMPLATE']->GetSnippet('CategoryRowFooter'); } $output .= $GLOBALS['AKB_CLASS_TEMPLATE']->GetSnippet('CategoryGridFooter'); } else { if ($catid == 0) { $output .= $GLOBALS['AKB_CLASS_TEMPLATE']->GetSnippet('CategoryRowHeader'); $output .= $GLOBALS['AKB_CLASS_TEMPLATE']->GetSnippet('CategoryRowCellNoCategories'); $output .= $GLOBALS['AKB_CLASS_TEMPLATE']->GetSnippet('CategoryRowFooter'); $GLOBALS['HideSubList'] = ''; } else { if (isInlineHelp()) { $GLOBALS['HideSubList'] = 'none'; } else { $output .= GetLang('catNoSubCategories'); } } } return $output; } } ?> I appreciate anyone's help on this matter. Quote Link to comment https://forums.phpfreaks.com/topic/188089-pins-to-the-eyes-confused-need-help/ Share on other sites More sharing options...
wildteen88 Posted January 11, 2010 Share Posted January 11, 2010 It looks like the constant CATEGORIES_PER_ROW is controlling how many columns are being displayed. You need to find where this constant is being defined, which is probably in some configuration file. Currently CATEGORIES_PER_ROW is set to 3. You need to change it to 4 in order for the 4gth column to display. Quote Link to comment https://forums.phpfreaks.com/topic/188089-pins-to-the-eyes-confused-need-help/#findComment-993001 Share on other sites More sharing options...
aeroswat Posted January 11, 2010 Share Posted January 11, 2010 CATEGORIES_PER_ROW... change that to 4 Quote Link to comment https://forums.phpfreaks.com/topic/188089-pins-to-the-eyes-confused-need-help/#findComment-993003 Share on other sites More sharing options...
mikeoffy69 Posted January 12, 2010 Author Share Posted January 12, 2010 Awesome thanks for the help. Found what I needed. Quote Link to comment https://forums.phpfreaks.com/topic/188089-pins-to-the-eyes-confused-need-help/#findComment-993571 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.