List All hidden categories

If you've problems with unsupported - non official ;-) - functionalities use this forum please.

List All hidden categories

Postby The_Brain on Fri May 11, 2007 17:07

Hi guys! I work with phpwcms for a couple of weeks and it's really great. Unofrtunately I get to a problem :(
I want to list all categories of a certain category in the main_block but not to have them in the left block. The reason is that I have about 80 sucategories which I don't want in the menu where I use NAV_LIST_UL.
I found a solution, but I don't think it's the best one, so I decide to ask.
My solution is making the categories hidden and adding a new replacment tag called {NAV_LIST_ID_ALL:id}.
I use the following code:
Code: Select all
// {NAV_LIST_ID_ALL:id}
if( ! ( strpos($content["all"],'{NAV_LIST_ID_ALL:')===false ) ) {
   $content["all"] = preg_replace('/\{NAV_LIST_ID_ALL:(.*?)\}/e', 'showCategoryContent("$1");', $content["all"]);
}


and

/
Code: Select all
*
* {NAV_LIST_ID_ALL}
* thanks to Jens Zetterström who has initiated this in 2005
* Shows all articles in a category without comparing acat_hidden.
* use it {SHOW_CONTENT:id}
* id is the corresponding ID
*/

function showCategoryContent($param='') {

$start_id      = $param[0];

if(!$GLOBALS['content']['struct'][$key]["acat_redirect"]) {
            $li_a .= '<a href="index.php?';
            if($GLOBALS['content']['struct'][$key]['acat_alias']) {
               $li_a .= $GLOBALS['content']['struct'][$key]['acat_alias'];
            } else {
               $li_a .= 'id='.$key.',0,0,1,0,0';
            }
            $li_a .= '"';
         } else {
            $redirect = get_redirect_link($GLOBALS['content']['struct'][$key]["acat_redirect"], ' ', '');
            $li_a .= '<a href="'.$redirect['link'].'"'.$redirect['target'];
         }


$ul =  "<ul>";
foreach($GLOBALS['content']['struct'] as $key => $value) {

   if($GLOBALS['content']['struct'][$key]['acat_struct'] == $start_id)
   {
        $li_a        = '';
        if(!$GLOBALS['content']['struct'][$key]["acat_redirect"]) {
            $li_a .= '<a href="index.php?';
            if($GLOBALS['content']['struct'][$key]['acat_alias']) {
               $li_a .= $GLOBALS['content']['struct'][$key]['acat_alias'];
            } else {
               $li_a .= 'id='.$key.',0,0,1,0,0';
            }
            $li_a .= '"';
         } else {
            $redirect = get_redirect_link($GLOBALS['content']['struct'][$key]["acat_redirect"], ' ', '');
            $li_a .= '<a href="'.$redirect['link'].'"'.$redirect['target'];
         }


        $li_title  = $wrap_link_text[0];
      $li_title .= html_specialchars($GLOBALS['content']['struct'][$key]['acat_name']);
      $li_title .= $wrap_link_text[1];

        $li_a .= '>'.$li_title;

      $li = $TAB.'   <li>'.$li_a.'</li>';
        $ul.= $li;
   }

}

$ul .= "</ul>";
return $ul;

}


Do you think it's a good solution and do you have another solution of the problem?
The_Brain
 
Posts: 4
Joined: Fri May 11, 2007 16:55

Postby Jensensen on Fri May 11, 2007 19:23

Hi Brain,

using {NAV_LIST_UL:F,,,,active} in your left menu, you can prevent from listing all subcategories.

F means --> folded



{NAV_LIST_CURRENT}

gives you the output of current category with all the actual subcategories.
should be placed in your 'main_block'.

but, wait, until 'flip-flop' - our so called 'list master' - will serve you a more detailed answer....


more hints to be found
http://www.phpwcms-docu.de/navigation_tags.phtml

greetz
weekly poll: This time you can win one installation of phpwcms FOR FREE!
And the question is: Where in which part of code can you find the expression "HORNBLOWER"? ==> PMme
And the winner is: ...
User avatar
Jensensen
 
Posts: 2613
Joined: Tue Oct 17, 2006 19:11
Location: Rhein-Ruhr-Stever

Postby The_Brain on Mon May 14, 2007 07:13

Thanks for your fast answer.
Sorry if my question is studpid but I searched quite a lto and I can't find what is folded ('F')f standing for.
If you can give answer or some docu of NAV_LIST_UL it'll be great.
Thank you!
The_Brain
 
Posts: 4
Joined: Fri May 11, 2007 16:55

Postby flip-flop on Mon May 14, 2007 10:19

>> DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
User avatar
flip-flop
 
Posts: 5682
Joined: Sat May 21, 2005 19:25
Location: HAMM (Germany)


Return to hacks & enhancements Support

Who is online

Users browsing this forum: Alexa [Bot] and 0 guests