Revision [6261]
This is an old revision of PageAndCategoryDivisionInACategory made by NilsLindenberg on 2005-02-23 11:49:21.
Division between Pages and categories in a Category
I haven't found the code for JWs better category-action, see WikkaBetaFeatures for what I mean, and therefore have just made some little changes to the 1.1.6.0 code:
If you use the following code to replace your actions/category.php, Categories are listed seperate from pages, and the first ones without the "Category" in front.
here's the code:
- <?php
- if ($cattag = $_REQUEST["wakka"])
- {
- $str ="";
- $categorystr="";
- if ($page=="/") $page="CategoryCategory";
- // $page= preg_replace( "/(\w+)\s(\w+)/", "$1$2",$page);
- {
- $class="class=\"$class\"";
- } else
- {
- $class="";
- }
- if (!$page) {$page=$cattag;}
- if ($this->CheckMySQLVersion(4,0,1))
- {
- $results = $this->FullCategoryTextSearch($page);
- }
- else
- {
- $results = $this->FullTextSearch($page);
- }
- if ($results)
- {
- if (!$compact) $str .= ' to ' . $page . ': <br /><br /><table '.$class.' width="100%"><tr>';
- else $str .= '<div '.$class.'><ul>';
- $categorystr .= ' pages belong to ' . $page . ': <br /><br /><div '.$class.'><ul>';
- $count = 0;
- $pagecount = 0;
- $categorycount = 0;
- {
- {
- $categorystr .= '<li>'.$this->Format('[['.$val.' '.preg_replace( "/Category/", "",$val).']]').'</li>';
- $categorycount++;
- }
- else // no, must be a page then!
- {
- if ($count == $col & !$compact) { $str .= "</tr><tr>"; $count=0; }
- if (!$compact) $str .= '<td>'.$this->Format('[['.$val.']]').'</td>';
- $count++;
- $pagecount++;
- }
- }
- if ($pagecount == 1) $str = 'The following page belongs'.$str;
- else $str = 'The following '.$pagecount.' pages belong'.$str;
- if ($categorycount == 1) $categorystr = 'The following category belongs'.$categorystr;
- else $categorystr = 'The following '.$categorycount.' categories belong'.$categorystr;
- if (!$compact) $str .= '</tr></table>'; else $str .= '</ul></div>';
- $categorystr .= '</ul></div>';
- }
- else $str .= 'Sorry, no items found for ' .$page .'.';
- if ($categorycount)
- {
- print ($categorystr);
- echo '<br /><br />';
- }
- if (pagecount) print($str);
- echo '<br /><br />';
- }
- ?>