1 (edited by Fil1958 2005-07-01 23:03)

Topic: Only display one Category

Hello wink

First, sorry for my English hmm

I made a little modification that can interest someone ! (I am a newbie in php code)
You can display only the category of your choice while clicking on it !

You can see it in action here

Edit 'index.php'

Search

// Print the categories and forums
$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.redirect_url, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE fp.read_forum IS NULL OR fp.read_forum=1 ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());

Replace with

if (isset($c))
$extra = $_GET['c'];
else
$c = 0;

if ($c == 0)

// Print the categories and forums
$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.redirect_url, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE fp.read_forum IS NULL OR fp.read_forum=1 ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());

else

$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.redirect_url, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE c.id='.$extra.' AND (fp.read_forum IS NULL OR fp.read_forum=1) ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());

Search

<div id="idx<?php echo $cat_count ?>" class="blocktable">
    <h2><span><?php echo pun_htmlspecialchars($cur_forum['cat_name']) ?></span></h2>

Replace with

<div id="idx<?php echo $cat_count ?>" class="blocktable">
    <h2><span><?php if ($c == 0) echo '<a href="index.php?c='.$cur_forum['cid'].'">'.pun_htmlspecialchars($cur_forum['cat_name']).'</a>'; else echo '<a href="index.php">'.pun_htmlspecialchars($cur_forum['cat_name']).'</a>'; ?></span></h2>

Et voilà tongue

Sorry I speak English like a Spanish cow :/
Multy Forums Free (Multi PunBB Project) (on stand by)
http://multy.forums.free.fr/forum_demo/

Re: Only display one Category

Your link does not work
(Votre lien ne fonctionne pas)

3 (edited by Fil1958 2005-07-01 01:42)

Re: Only display one Category

Sorry hmm

The server have some problems !
Try again later please

Edit: Link is working now !

Sorry I speak English like a Spanish cow :/
Multy Forums Free (Multi PunBB Project) (on stand by)
http://multy.forums.free.fr/forum_demo/

Re: Only display one Category

Great I was looking for something like this

Re: Only display one Category

Bonjour!  (I wish my French was as good as your English)

I was very happy to see this mod posted.  I checked out your site and it's exactly what I was looking for. However, when I implemented the changes, there seemed to be no effect other then the category titles now where links.  I'm using punBB 1.2.9. Could this be a problem?

Re: Only display one Category

Hallo
I have the same like JonathonDM The categories are now links, nothing else.

The poor horseman without horses
www.galopp-sport.eu

http://claimid.com/jlangrock
[img]http://claimid.com/images/hcard.gif[/img]

Re: Only display one Category

I wondered with

http://multy.freezee.org/article.php

do you have a plan to release article mod ?